Re: A really basic drawing question

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
On Oct 31, 2020, at 6:45 PM, Phil <[email protected]> wrote:
> 
> Thank you for reading this.
> 
> It's been awhile since I've done anything useful with wxPython and I find that I now cannot get past a very basic concept.
> 
> I want to call Fill_board() but even though the function is called it's not drawing anything, just a blank window is displayed. It must have something to do with a drawing context.

The problem is timing.  You are trying to do drawing during __init__, but your window does not actually exist until (relatively) long after __init__ finishes.  Remember that these systems are all event driven.  Your __init__ call creates window data structures in memory, but nothing gets drawn on the screen until __init__ returns and the main code is able to queue up a “paint” request.  It can’t do any drawing until the sizers get a change to adjust everything, and that only happens when everybody is initialized.

So, you can call Fill_board the way you describe, but you must do it in response to a window message, and __init__ is not a window message.
— 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

-- 
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/F2C3C04D-4EBA-42D2-B7D4-D575AEED53A6%40probo.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.