[Tutor] Empty GraphicsWindow
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
> # If the column is even set color to yellow, if odd black
> drawRow(canvas, row, gapX, numCols, gapY, "yellow", "black")
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.
Author of the Learn to Program web site
Follow my phopto-blog on Flickr at:
More information about the Tutor