Re: trouble with wxPython intro
- From: 7stud <bbxx789_05ss@xxxxxxxxx>
- Date: 31 May 2007 00:56:01 -0700
On May 30, 11:41 pm, Anthony Irwin <nos...@xxxxxxxxxxxxxxxxxxx> wrote:
Daniel Gee wrote:
I'm trying to learn WxPython with the tutorial:
http://wiki.wxpython.org/Getting_Started
I'm a wxPython beginner too, but instead of Anthony Irwin's
suggestions, I think you should delete these two lines:
ID_ABOUT=101
ID_EXIT=110
and use:
wx.ID_ABOUT
wx.ID_EXIT
throughout the body of your program. As far as I can tell, there is
no reason for you to be manually setting your own id's (is there
ever?). Instead, you can use the ids in the wx module.
In addition, I suggest you never use wx.PySimpleApp(). If you create
your own app class, you can send the error messages to the console.
Instead of always seeing a window that flashes at you briefly and
being left with no clue what went wrong, you can at least see an error
message and a line number in the console. Here's how you would do
that:
-----------------
import wx
class MyFrame(wx.Frame):
def __init__(self, mytitle):
wx.Frame.__init__(self, None, title= mytitle)
class MyApp(wx.App):
def __init__(self):
wx.App.__init__(self, redirect=False)
app = MyApp()
window = MyFrame("Testing")
window.Show()
app.MainLoop()
------------------
By setting redirect=False in wx.App.__init__(), the errors will be
sent to the console.
.
- Follow-Ups:
- Re: trouble with wxPython intro
- From: 7stud
- Re: trouble with wxPython intro
- References:
- trouble with wxPython intro
- From: Daniel Gee
- Re: trouble with wxPython intro
- From: Anthony Irwin
- trouble with wxPython intro
- Prev by Date: Re: c[:]()
- Next by Date: Re: trouble with wxPython intro
- Previous by thread: Re: trouble with wxPython intro
- Next by thread: Re: trouble with wxPython intro
- Index(es):
Relevant Pages
|