Re: wxpython: where is the demo?
That's a separate download. Morpheus "John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I just realized that after installing wxPython, it did not add the usual > menu item to my Start menu (Windows), where I can access the docs and > demo. I searched through the wxPython folder in the site-packages > directory, but I can't seem to find it. > > Anyone know how I can get this back? > > Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxpython: another missing attribute
"John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ah, the object-oriented stuff is just so FUN! :) Here's my code, > followed by the error. I thought I was referring to the 'text' attribute > correctly, but it seems not. > > import wx > > > class InputForm(wx.Frame): > > def __init__(self, parent, id, title, pos=wx.DefaultPosition, > size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, > name='frame'): > wx.Frame.__init__(self, parent, id, title, pos, size, style, name) > panel = wx.Panel(self) > text = wx.StaticText(panel, -1, 'Click results') This becomes a local var, i.e. local to __init__. To make it an instance var write self.text = wx.StaticText(panel, -1, 'Click results') HTH Morpheus > btnOK = wx.Button(panel, -1, 'OK') > self.Bind(wx.EVT_BUTTON, self.clickOK, btnOK) > btnCancel = wx.Button(panel, -1, 'Cancel') > self.Bind(wx.EVT_BUTTON, self.clickCancel, btnCancel) > sizer = wx.BoxSizer(wx.HORIZONTAL) > sizer.Add(btnOK, 0, wx.ALL, 10) > sizer.Add(btnCancel, 0, wx.ALL, 10) > sizer.Add(text, 0, wx.ALL, 10) > panel.SetSizer(sizer) > > def clickOK(self, event): > self.text.SetLabel('You clicked OK') > > def clickCancel(self, event): > self.text.SetLabel('You clicked Cancel') > > > class MyApp(wx.App): > > def OnInit(self): > frame = InputForm(None, -1, 'Data Entry Form') > self.SetTopWindow(frame) > frame.Show() > return True > > > app = MyApp() > app.MainLoop() > > --- > > Traceback (most recent call last): >File "C:\Python24\myscripts\wx_tests\wxtest.py", line 23, in clickOK > self.text.SetLabel('You clicked OK') > AttributeError: 'InputForm' object has no attribute 'text' -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: Should you use a master sizer object?
IIRC the wx dox contain stuff about sizers too. It's definitly worth to get into this stuff. Once you are used to sizers, you don't want to miss them anymore. HTH Morpheus "John Salerno" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Steve Holden wrote: > > > There doesn't seem to be any really usable material to help beginners. A > > recursive design approach seems best, breaking down each grouping, but I > > have sometimes found it difficult to adapt a design to changes. > > > > Although I'm a big fan of open source I must confess that to solve this > > problem I eventually bought a copy of wxDesigner, which while not > > perfect does help quite a lot, and allows cut/copy and paste of design > > elements. > > Yeah, it would be nice to use something like wxDesigner eventually, but > right now I'd like to learn how to write it all by hand, so I can know > what's going on. > > There are a couple of screencasts about using sizers with Dabo that are > helpful, even though it's specific to that designer. It still shows how > to layout nested sizers, for example. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxTimer problem
On Fri, 15 Sep 2006 12:47:30 -0700, abcd wrote: > I have a python script which creates a wx.App, which creates a wx.Frame > (which has a wx.Timer). > > looks sorta like this: > > class MyProgram: > def __init__(self): > self.app = MyApp(0) > self.app.MainLoop() > > class MyApp(wx.App): > def OnInit(self): > self.myframe= MyFrame() > self.myframe.Show(True) > self.SetTopWindow(self.myframe) > return True > > class MyFrame(wx.Frame): > def __init__(self): ># do some other stuff here > ># setup the timer > self.timer = wx.Timer(self) > self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) > self.timer.Start(100) > > def killTimer(self): > self.Unbind(wx.EVT_TIMER) > self.timer.Stop() > self.timer = None > > > that's the jist of it. > > Anyhow, so I startup python and import my script, which loads up the > wx.App, frame and all. > > foo = MyProgram() > > > Then I close the frame. when the frame is closed it calls killTimer. > This method gets called and no exceptions occur. > > Then...I create a new instance of the app and try to load the frame > again. > > foo = MyProgram() > > ...and I am getting this error: > > "timer can only be started from the main thread" > > how can I fix this?? > > FYI, my script is being started by a new thread each time, so > ultimately we have > > def startProgram(): > foo = MyProgram() > > threading.Thread(target=startProgram).start() > > > Thanks in advance. You must not access wx from more than one thread. Read their wiki about this and about the appropriate workaround. Morpheus -- http://mail.python.org/mailman/listinfo/python-list
What am I supposed to do with an egg?!
On Windows I'm used to install packages by setup.py install. So did I with Fibranet nanothreads - a few seconds and it was installed. On Linux (ubuntu 6.06) all I could get at is an egg file. I found out that I have to exec easy_install, which didn't much help here (seems to me, at least - sorry, Linux newbie). So, what am I supposed to do here now? Kind regards Morpheus -- http://mail.python.org/mailman/listinfo/python-list
Re: What am I supposed to do with an egg?!
On Wed, 20 Dec 2006 13:35:26 +, Duncan Booth wrote: > "F. GEIGER" <[EMAIL PROTECTED]> wrote: > >> Sorry for not being clear. I did exec easy_install - no errors so far. >> But the egg was still there. I'd expected, that it was converted into >> .py-files somehow, which could be imported by my modules. > > The .egg file should have been copied into your site-packages. Python can > import directly from a .egg file (it is a zip archive containing .py > files), or you can give easy_install an --always-unzip argument in which > case it creates a folder with the same name (including the .egg extension) > in site-packages and unzips the egg there. Thanx a lot! "sudo python setup.py easy_install --always-unzip ." did the trick Kind regards Morpheus > > Forcing an unzip can be useful if you want to use tools like pydoc which > don't understand imports from zip files. > > If you run python interactively and "print sys.path" then you should see > any egg files you have installed have been added to the path. -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: panel not fully painted
On Wed, 24 Jan 2007 13:35:51 -0800, citronelu wrote: > Hi, > > I'm new to wxpython, and the following code is my first serious > attempt: > > > #~ start code > import wx > > class MyPanel(wx.Panel): > def __init__(self, parent, id): > wx.Panel.__init__(self, parent, id) > self.parent = parent > button = wx.Button(self, -1, "Refresh") > button.SetPosition((100, 100)) > button.SetFocus() > > self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button) > > def OnCloseMe(self, event): > self.parent.f_redraw(self) > pass > > > class MyFrame(wx.Frame): > def __init__( > self, parent, ID, title, pos=wx.DefaultPosition, > size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE > ): > > wx.Frame.__init__(self, parent, ID, title, pos, size, style) > > def f_redraw(self, kill_window): > kill_window.Destroy() > MyPanel(self, -1) > #~ self.SendSizeEvent() > > > wxApp = wx.App() > f = MyFrame(None, -1, "App Title") > MyPanel(f, -1) > f.Show() > wxApp.MainLoop() > > > #~ end code > > > My problem is: when I press the "refresh" button, the new panel is > painted only as a 20x20 pixels square on the top right side of the > frame. If I resize the frame, the panel is repainted correctly (that's > why I inserted the self.SendSizeEvent() line - commented above). > > Is there something I'm missing, or this is normal ? > > I'm using python 2.4.3 and wxpython 2.8.1.1 unicode, on WinXP SP2. > Windows extensions are also installed. Consider using sizers, you'll need them anyway. They do such things for you, and many other things too. The help file has a good chapter on this: Working with sizers. Kind regards Morpheus -- http://mail.python.org/mailman/listinfo/python-list
Re: How to detect closing of wx.Panel?
On Mon, 19 Feb 2007 01:18:11 +, Jacol wrote: > Hi everybody, > > I have poblem with detecting closing of wx.Panel by user. How to detect that > event? > Don't know why you want to do that, but you could register with the enclosing (hosting) widget. > The wx.EVT_CLOSE event concerns wx.Frame class only. Neither Close() nor > Destroy() aren't executed if the event occurs (if user close a panel). Thus > extanding these both methods doesn't make sens (I've tested that). > > With many thanks & > Best wishes, > Jacek Cheers Morpheus -- http://mail.python.org/mailman/listinfo/python-list