Guest User

Untitled

a guest
Feb 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. import wx
  2.  
  3. class bucky(wx.Frame):
  4.  
  5.     def __init__(self,parent,id):
  6.         wx.Frame.__init__(self,parent,id,"Frame aka window",size=(600,400))
  7.         panel=wx.Panel(self)
  8.         button=wx.Button(panel,label="Exit",pos=(50,10),size=(60,60))
  9.         buttonw=wx.Button(panel,label="Write",pos=(140,10),size=(60,60))
  10.         self.Bind(wx.EVT_BUTTON,self.writerow,buttonw)
  11.         self.Bind(wx.EVT_BUTTON,self.closebutton,button)
  12.         self.Bind(wx.EVT_CLOSE,self.closewindow)
  13.        
  14.        
  15.        
  16.         status=self.CreateStatusBar()
  17.         menubar=wx.MenuBar()
  18.         first=wx.Menu()
  19.         second=wx.Menu()
  20.         first.Append(wx.NewId(),"New Window","test")
  21.         second.Append(wx.NewId(),"Close Window","test")
  22.         menubar.Append(first,"File")
  23.         menubar.Append(second,"Edit")
  24.         self.SetMenuBar(menubar)
  25.        
  26.        
  27.        
  28.        
  29.        
  30.     def closebutton(self,event):
  31.         self.Close(True)
  32.    
  33.    
  34.     def closewindow(self,event):
  35.         self.Destroy()
  36.        
  37.    
  38.     def writerow(self,event):
  39.         print "this is a test"
  40.        
  41.        
  42.        
  43.        
  44.        
  45. if __name__=='__main__':
  46.     app=wx.PySimpleApp()
  47.     frame=bucky(parent=None,id=-1)
  48.     frame.Show()
  49.     app.MainLoop()
Add Comment
Please, Sign In to add comment