I have a decent knowledge of python and I'm somewhat new to
wxwindows/wxpython.
I don't understand how the display of widgets are controlled. I took a
simple example from the demo docs and edited it so I would have a better
chance of understanding what controls the display.
In the example, I created a small grid and calendar. If I leave both in,
the calendar is displayed and the grid is not displayed; if I comment
either out, the other is displayed. I'm not trying to create anything
useful, just understand the underlying mechanism.
Without using too much of your time, would it be possible for someone to
shed some light on the matter? The example is appended below.
Thanks,
gary
from wxPython.wx import *
from wxPython.calendar import *
from wxPython.grid import *
class BasicGrid(wxGrid):
def __init__(self, parent):
wxGrid.__init__(self, parent, -1)
self.moveTo = None
self.CreateGrid(4, 4)
self.SetCellValue(0, 0, "First cell")
self.SetCellValue(1, 1, "Another Cell")
EVT_IDLE(self, self.OnIdle)
def OnIdle(self, evt):
if self.moveTo != None:
self.SetGridCursor(self.moveTo[0], self.moveTo[1])
self.moveTo = None
evt.Skip()
class MyFrame(wxFrame):
def __init__(self, parent, ID, title):
wxFrame.__init__(self, parent, ID, title,
wxDefaultPosition, wxSize(800, 800))
grid = BasicGrid(self)
cal = wxCalendarCtrl(self, -1, wxDateTime_Now(),
pos = (25,50),
style = wxCAL_SHOW_HOLIDAYS | wxCAL_SUNDAY_FIRST)
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Example")
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()