This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > VRML > February 2004 > wxGlade





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author wxGlade
Pilu

2004-02-19, 10:30 am

hi,given that I'm a newbie in python,
I have a little problem with wx...
Maybe it's a stupid thing,but if u want help me!
I used  wxglade to generate a simple  window with a button!
wxglade generates the code,and now I try to insert  events,but I have an
error,I don't understand!
The code is this:

from wxPython.wx import *

class MyFrame(wxFrame):
     def __init__(self, *args, **kwds):
         # begin wxGlade: MyFrame.__init__
         kwds["style"] = wxDEFAULT_FRAME_STYLE
         wxFrame.__init__(self, *args, **kwds)
         self.button_1 = wxButton(self, -1, "button_1")

         self.__set_properties()
         self.__do_layout()
         # end wxGlade
EVT_BUTTON(self, 1003, self.event)

     def __set_properties(self):
         # begin wxGlade: MyFrame.__set_properties
         self.SetTitle("frame_1")
         # end wxGlade

     def __do_layout(self):
         # begin wxGlade: MyFrame.__do_layout
         sizer_1 = wxBoxSizer(wxVERTICAL)
         sizer_1.Add(self.button_1, 0, 0, 0)
         self.SetAutoLayout(1)
         self.SetSizer(sizer_1)
         sizer_1.Fit(self)
         sizer_1.SetSizeHints(self)
         self.Layout()
         # end wxGlade
     def event(self):
      print "ciao"

# end of class MyFrame


class MyApp(wxApp):
     def OnInit(self):
         frame = MyFrame(NULL, -1, "Hello from wxPython")
         frame.Show(true)
         self.SetTopWindow(frame)
         return true

app = MyApp(0)
app.MainLoop()





Thanks
-pilu-
Pilu

2004-02-19, 10:30 am

sorry,
sorry, I've got the wrong N.G.


aaaaaaaaaaaaaaaaaaaaaaaaaaaaa!
-pilu-
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews