Я создаю приложение wxPython, в котором перечислены строки кнопок. При нажатии кнопок отображается всплывающее сообщение (которое будет цитатой). У меня возникли проблемы с программированием кнопок для отображения всплывающего сообщения.wxPython Buttons and Pop up Message
1) У меня возникли проблемы со всплывающим сообщением, отображаемым после нажатия кнопки wx.ToggleButton.
2) Другая проблема заключается в том, как я могу сделать несколько кнопок, которые будут каждое отображение различных сообщений
import wx
class MyDialog(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(350,300))
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(550,500))
self.CreateStatusBar() #Creates the Statusbar in bottom
filemenu = wx.Menu()
#About and Exit
menuAbout = filemenu.Append(wx.ID_ABOUT, "&About",
" Information about this programme")
menuExit = filemenu.Append(wx.ID_EXIT, "E&xit",
" Terminate the programme")
menuBar = wx.MenuBar()
menuBar.Append(filemenu, "&File")
self.SetMenuBar(menuBar)
panel = wx.Panel(self, -1)
wx.ToggleButton(panel, 1, 'Quote1', (100,100))
self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout)
self.Bind(wx.EVT_MENU, self.OnExit, menuExit)
def Quote1(self, e):
description = """Message Here"""
def OnAbout(self, e):
dlg = wx.MessageDialog(self, "About here ")
dlg.ShowModal()
dlg.Destroy()
def OnExit(self, e):
self.Close(True)
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, 'customdialog1.py')
frame.Show(True)
frame.Centre()
return True
app = MyApp(0)
app.MainLoop()