- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 wxpython
类 Neoprobe,它有 3 个类/笔记本页面
class Neoprobe(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Neoprobe QC Application",size=(750,900))
# Here we create a panel and a notebook on the panel
panel = wx.Panel(self)
nb = wx.Notebook(panel)
# create the page windows as children of the notebook
page1 = Sensitivity(nb)
page2 = Angular(nb)
page3 = Distance(nb)
# add the pages to the notebook with the label to show on the tab
nb.AddPage(page1, "Sensitivity")
nb.AddPage(page2, "Angular")
nb.AddPage(page3, "Distance")
我想要一个退出按钮来关闭笔记本每一页上的应用程序。例如,在“Angular”页面中,我有以下代码
class Angular(wx.Panel):
def __init__(self, parent):
.
.
.
hbox2 = wx.BoxSizer(wx.HORIZONTAL)
graph_btn = wx.Button(top_panel, label='Plot', size=(70, 30))
hbox2.Add(graph_btn)
db_btn = wx.Button(top_panel, label='Update db', size=(100, 30))
hbox2.Add(db_btn, flag=wx.LEFT|wx.BOTTOM, border=5)
exit_btn = wx.Button(top_panel, label='Exit', size=(70, 30))
hbox2.Add(exit_btn, flag=wx.LEFT|wx.BOTTOM, border=5)
top_panel_sizer.Add(hbox2, flag=wx.ALIGN_RIGHT|wx.RIGHT, border=10)
#Setup button bindings
self.Bind(wx.EVT_BUTTON, self.OnExit, exit_btn)
def OnExit(self,event):
dlg = wx.MessageDialog(self,
"Do you really want to close this application?",
"Confirm Exit", wx.OK|wx.CANCEL|wx.ICON_QUESTION)
result = dlg.ShowModal()
dlg.Destroy()
if result == wx.ID_OK:
self.Close()
但是,这(显然)不会关闭 wx.Frame。我该怎么做?
最佳答案
如果您尝试关闭应用程序,那么您需要调用以下内容:
top = wx.GetApp().GetTopWindow()
top.Close()
编辑: 更正了使用静态 wx.GetApp() 检索应用程序的代码。
关于python - 记事本每帧上关闭应用程序的 wxPython 按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18053539/
我是编程新手,我开始创建一个简单的记事本,只有 4 个按钮(打开、保存、新建和字体)。 如果我打开或保存我收到一个错误:这是我的代码: //Declare save as a new
我用vba编写了一个宏,它用记事本打开一个文本文件,选择所有txt并将其复制到Excel。我每天必须以这种方式处理大约 100 个文件,并且我想保留我观察到的闪烁图像。代码可以工作,但问题是命令 Ap
所以我一直在寻找将我创建的 JSON 数据库连接到 Java 程序的方法,我似乎找不到适合这种特定情况的任何内容,因此我尝试使用 JDBC 教程(http://www.tutorialspoint.c
我想在记事本中显示一个消息框,所以我找到了一个简单的dll 注入(inject)示例。注入(inject)器本身不是我的并且似乎工作正常(获取进程的 id ,创建一个远程线程,获取 dll 文件的绝对
Dim ProcessProperties As New ProcessStartInfo() ProcessProperties.FileName = "notepad.exe" ProcessPr
我使用 Process.Start() 从我的程序中打开一个记事本,但新打开的记事本覆盖了屏幕。但我确实希望我的应用程序保持其焦点。 我类似地(使用相同的 Process.Start)打开 MS Ex
之前进行Web开发的时候使用的是myeclipse,但只用过的人都知道,由于其插件太多,而且有很多插件的功能根本就接触不到。所以导致一旦工程稍微大一点就会很卡,虽然之前也对其进行优化过,但还是觉得不
在 android Notes 演示中,它接受 URI: sUriMatcher.addURI(NotePad.AUTHORITY, "notes", NOTES); sUriMatc
我想知道,如何将 Redhat 中的 vi 编辑器中的整行文本复制到 Windows 中的记事本中。 如果要复制的文本尺寸很小,可以通过鼠标选择行并复制到记事本来轻松完成。但是我遇到过复制数千行的情况
主要目的是了解是否有办法从 UMDF(用户模式驱动程序框架)事件启动或执行任何用户模式应用程序。事件无关紧要。任何事件都可能起作用,例如DriverEntry、DeviceAttach 我正在研究一种
我有制表符分隔的值,需要使用 Java 将其导出为文本文件,以便在 Microsoft Excel 中打开。当制表符分隔值包含中文字符时就会出现问题。 我尝试使用 UTF-8 导出文本文件,但 Exc
我们如何管理使用 Win32 api 运行的应用程序的 wndproc 函数?我使用的软件语言是 Go。 我尝试了不止一种方法,但无法做到。你能帮我吗? I am learning the HANDL
我在源代码管理中打开历史记录,然后打开一个变更集,然后在文件列表中选择一个文件并双击打开它。 TFS 通过记事本打开文件,我想通过 Visual Studio 或任何其他文本编辑器(以突出显示语法)打
Win32的FindWindow()可以找到标题为“Untitled - Notepad”的窗口,但是如果我只想找到一个记事本窗口但不知道是不是“try. bat - 记事本”或标题栏上的其他文件名?
我是一名优秀的程序员,十分优秀!