[wxPython-users] Custom calendar :: refresh problem
Robin Dunn
robin at alldunn.com
Sat Nov 3 16:30:46 PDT 2007
Patrick J. Anderson wrote:
> I'm trying to build a custom planner and being new to wxPython and
> desktop programming in general, I'm still learning how to do things.
>
> Below is a little test I wrote. Its a frame with a splitter window. On
> the left there is a calendar control which I use to change dates and on
> the right, I have a notebook with 3 pages: 'Day', 'Week', 'Month', which
> correspond to the date selected in the calendar on the left.
>
> I have created the daily, weekly and monthly views of the planner with a
> wx.FlexGridSizer and mostly wx.Panels.
>
> I decided to recreate the properties and layout of each notebook page.
> I'm not sure if this is the right approach to building such widgets, as
> for example the CalendarCtrl is drawn on the screen and not combined from
> individual panels, but this is just a prototype.
>
> However, as you may notice if you run it, I notice that the notebook
> pages flicker and quite often I see a small panel in the top left corner,
> which I believed shows when I loop through the days to create the display.
>
> Any way this could be avoided and the transition made smoother?
It looks like you are creating a new set of widgets when you change
dates. You really don't want to do that, you'll eventually run out of
resources. Instead just change the values displayed by the existing
widgets. Also you may want to rethink how you are creating a separate
panel for every rectangle in the planners. It would probably be better
to just have a single panel and draw the rectangles and the text
yourself in the panel's EVT_PAINT handler.
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list