[Tutor] Empty GraphicsWindow
Alan Gauld
alan.gauld at btinternet.com
Fri Nov 21 10:33:07 CET 2014
On 21/11/14 03:00, niyanaxx95 at gmail.com wrote:
> I need help figuring why my GraphicsWindow empty, I cannot figure out
> why it is empty.
> Here is my code :
>
> # Import graphics from module
> from graphics import GraphicsWindow
Since 'graphics' is not a standard part of Python can you tell
us where you are getting it from? Thee are at least 2 graphics
modules out there, probably more.
> tileSize = 0
>
> def main() :
>
...
> # Draw graphics window
> win = GraphicsWindow(roomWidth, roomLength)
> canvas = win.canvas()
>
> # Draw the checkered surface
> for row in range(numRows) :
> # If the row is even
> if row % 2 == 0 :
> # If the column is even set color to black, if odd yellow
> drawRow(canvas, row, gapX, numCols, gapY, "black", "yellow")
>
> # If the row is odd
> else:
> # If the column is even set color to yellow, if odd black
> drawRow(canvas, row, gapX, numCols, gapY, "yellow", "black")
>
> win.wait()
What does win.wait() do? Usually there is some kind of refresh() or
update command to force a canvas to redraw itself. wait() sounds more
like it just leaves the window in-situ until something closes it?
But without knowing anything about your library its hard to be sure.
You may have more luck finding an expert by contacting a forum for
your specific graphics package.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my phopto-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list