Hi,
I'm new to wxpython, and the following code is my first serious
attempt:
#~ start code
import wx
class MyPanel(wx.Pane l):
def __init__(self, parent, id):
wx.Panel.__init __(self, parent, id)
self.parent = parent
button = wx.Button(self, -1, "Refresh")
button.SetPosit ion((100, 100))
button.SetFocus ()
self.Bind(wx.EV T_BUTTON, self.OnCloseMe, button)
def OnCloseMe(self, event):
self.parent.f_r edraw(self)
pass
class MyFrame(wx.Fram e):
def __init__(
self, parent, ID, title, pos=wx.DefaultP osition,
size=wx.Default Size, style=wx.DEFAUL T_FRAME_STYLE
):
wx.Frame.__init __(self, parent, ID, title, pos, size, style)
def f_redraw(self, kill_window):
kill_window.Des troy()
MyPanel(self, -1)
#~ self.SendSizeEv ent()
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.SendSizeEv ent() 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.
I'm new to wxpython, and the following code is my first serious
attempt:
#~ start code
import wx
class MyPanel(wx.Pane l):
def __init__(self, parent, id):
wx.Panel.__init __(self, parent, id)
self.parent = parent
button = wx.Button(self, -1, "Refresh")
button.SetPosit ion((100, 100))
button.SetFocus ()
self.Bind(wx.EV T_BUTTON, self.OnCloseMe, button)
def OnCloseMe(self, event):
self.parent.f_r edraw(self)
pass
class MyFrame(wx.Fram e):
def __init__(
self, parent, ID, title, pos=wx.DefaultP osition,
size=wx.Default Size, style=wx.DEFAUL T_FRAME_STYLE
):
wx.Frame.__init __(self, parent, ID, title, pos, size, style)
def f_redraw(self, kill_window):
kill_window.Des troy()
MyPanel(self, -1)
#~ self.SendSizeEv ent()
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.SendSizeEv ent() 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.
Comment