[Tutor] [wxPython-users]How to avoid the traces of frame or panelwindow

Alan Gauld alan.gauld at btinternet.com
Thu Nov 29 10:04:02 CET 2007

"Varsha Purohit" <varsha.purohit at gmail.com> wrote

>         I created a simple frame, but when i move the frame or any 
> panel
> window i get traces of the windows all over which makes the screen 
> look
> shabby. How can i avoid getting them ? sample code for a panel is

> # simple.py
> import wx
> app = wx.App()
> frame = wx.Frame(None, -1, 'simple.py')
> frame.Show()
> app.MainLoop()

You need to create a subclass of App or use PySimpleApp.
The best way is to subclass App:

import wx
class MyApp(wx.App):
    def OnInit(self):
        frame = wx.Frame(None, -1, 'simple')
        return True

app = MyApp()

Does that work?

> Also, i have another problem, whenever i execute any wxpython 
> program
> inorder to execute it again i have to close all the programs 
> including the
> shell and then restart python otherwise i get like 25lines of some 
> stupid
> error messages having no link to the program. I have to close all 
> python
> programs again !!! Does anybody now why i am getting this....

No, but it could be related to the fact that your code wasn't 
subclassing App.
See if the same happens with the sample above.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list