1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| #!/usr/bin/env python
import wx#The programm will use wxPython
class Frame(wx.Frame): #Creation of our own frame class
pass
class App(wx.App): #wxPython Application Subclass
def OnInit(self):
self.frame = wx.Frame(parent=None, id=-1, title='Test wxPython', size=(300, 300)) #create frame
self.frame.Show() #The frame is shown (other method : Hide)
self.SetTopWindow(self.frame) #Specifie that the frame will be the main
self.bonjour = wx.wxStaticText(parent=self.frame, id=-1, label="Bonjour !")
self.bonjour.Show()
return True
def Bonjour(self):
self.bonjour = wxStaticText(parent=self.frame, id=-1, label="Bonjour !")
self.bonjour.Show()
return True
def main(): #Equivalent of the "main" C programms function
app = App()
app.MainLoop() #Main event loop
if __name__ == '__main__': #Make sure the programm has been executed
main() |
Partager