Ciao a tutti. Sto iniziando ad utilizzare WxPython seguendo le "wiki" ..
<codice> class MainWindow(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(600,300)) #self.control = wx.TextCtrl(self, size=(200, 100), style=wx.TE_MULTILINE) self.pulsante = wx.Button(self, -1, "Prova", pos=(50, 100)) self.CreateStatusBar() # A Statusbar in the bottom of the window # Setting up the menu. filemenu= wx.Menu() # wx.ID_ABOUT and wx.ID_EXIT are standard IDs provided by wxWidgets. about=filemenu.Append(wx.ID_ABOUT, "&About"," Information about this program") open_=filemenu.Append(-1 , "&Open"," Open file") filemenu.AppendSeparator() esci = filemenu.Append(wx.ID_EXIT,"E&xit"," Terminate the program") self.Bind(wx.EVT_MENU,self.OnAbout,about) self.Bind(wx.EVT_MENU,self.OnOpen,open_) self.Bind(wx.EVT_MENU,self.OnExit,esci) # Creating the menubar. menuBar = wx.MenuBar() menuBar.Append(filemenu,"&File") # Adding the "filemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. self.Show(True) def OnAbout(self,event): dlg = wx.MessageDialog( self, "A small text editor", "About Sample Editor") dlg.ShowModal() #dlg.Destroy() def OnExit(self,event): self.Close(True) def OnOpen(self,e): #""" Open a file""" self.dirname = '' dlg = wx.FileDialog(self, "Choose a file", self.dirname, "", "*.py*") if dlg.ShowModal() == wx.ID_OK: self.filename = dlg.GetFilename() self.dirname = dlg.GetDirectory() f = open(os.path.join(self.dirname, self.filename), 'r') self.control.SetValue(f.read()) f.close() dlg.Destroy() app = wx.App(False) frame = MainWindow(None, "Sample editor") app.MainLoop() <fine_codice> Il pulsante "Prova" che cerco di inserire, mi occupa tutto lo schermo..anche se provo a settare il size del pulsante. Dove sbaglio?
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python