RE: re drawing question
Steve Barnes <[email protected]> Thu, 5 Nov 2020 05:53:43 +0000
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <VI1PR03MB447911A8039E5BC33CCFB1229BEE0@VI1PR03MB4479.eurprd03.prod.outlook.com> |
You could possibly consider any of: * using a virtual desktop of your maximum size, * on the first call to Fill_Board using a random number generator to create a seed that you then re-use on each subsequent call * using a pseudo-random function that produces consistent results The first option will slow down your first draw but will speed up all refreshes. Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10 From: Phil<mailto:[email protected]> Sent: 01 November 2020 07:22 To: [email protected]<mailto:[email protected]> Subject: Re: [wxPython-users] re drawing question On 1/11/20 4:50 pm, Tim Roberts wrote: > What’s the point of one-time-only drawing? If your app gets covered by > another application or a menu or a system dialog, how do you think > that part of your window will get redrawn? Your onPaint handler needs > to be able to recreate the entire window to reflect your current state. > As a general rule, your mainline code should update variables and lists, and then call Refresh to trigger a call to onPaint to do the drawing. OK Tim, I see your point. I'll have to rethink the logic of what I'm trying to achieve. Fill_Board() creates a grid of randomly coloured squares. As it stands, resizing the window will recreate the board but with a different set of randomly coloured squares which is not what I want. The creation of the randomly coloured squares should be a one-time action and that's where a boolean one-time variable should take control. It seems clumsy to me at the moment, maybe the idea just needs some refining. -- Regards, Phil -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/c5ecbd9a-57bb-90d2-a2d6-3e7aad74144a%40gmail.com. -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/VI1PR03MB447911A8039E5BC33CCFB1229BEE0%40VI1PR03MB4479.eurprd03.prod.outlook.com.