unexpected results

Discussion in 'Python' started by Fig, Sep 16, 2011.

  1. Fig

    Fig Guest

    I am having a problem when I run a graphics program that I created. I
    do not get an error when I run the program, there are just some weird
    things going on. I do not know if it is the program causing the
    problem or a bug in Python. Here is the code for the program:


    from gasp import *

    begin_graphics(width=640, height=480, title='Houses at Night',
    background=color.BLACK)

    def draw_house(x, y): # function for drawing a house
    a = (x, y + 100) # 'a' coordinate for Polygon
    b = (x +50, y +140) # 'b' coordinate for Polygon
    c = (x +100, y + 100) # 'c' coordinate for Polygon
    Box((x, y), 100, 100, filled=True, color=color.BLUE) # the
    house
    Box((x + 35, y), 30, 50, filled=True, color=color.GREEN) #
    the door
    Circle((x + 62, y + 16), 1, filled=True, color=color.GOLD)
    # the door knob
    Box((x + 20, y + 60), 20, 20, filled=True,
    color=color.YELLOW) # the left window
    Line((x + 20, y + 71), (x + 40, y + 71),
    color=color.ORANGE) # horizontal line (left window)
    Line((x + 29, y + 60), (x + 29, y + 80),
    color=color.ORANGE) # vertical line (left window)
    Box((x + 60, y + 60), 20, 20, filled=True,
    color=color.YELLOW) # the right window
    Line((x + 60, y + 71), (x + 80, y + 71),
    color=color.ORANGE) # horizontal line (right window)
    Line((x + 69, y + 60), (x + 69, y + 80),
    color=color.ORANGE) # vertical line (right window)
    Polygon([a, b, c], filled=True, color=color.RED) # the roof

    draw_house(20, 20)
    draw_house(270, 20)
    draw_house(520, 20)
    draw_house(145, 180)
    draw_house(395, 180)
    draw_house(270, 340)

    update_when('key_pressed')
    end_graphics()



    The program launches just fine, bringing up the gasp window like it
    should. The problem is that almost all of the calls to 'draw_house'
    are different. Some features will show up in one house but not in
    another and visa versa. Does anyone have any idea what the problem may
    be?
     
    Fig, Sep 16, 2011
    #1
    1. Advertising

  2. Fig

    Fig Guest

    Sorry, Everyone. I got an error when posting the first post and did'nt
    come in to see if it had actually posted before I tried another post.
     
    Fig, Sep 16, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Scott Lander

    Re: unexpected results

    Scott Lander, Jul 7, 2003, in forum: Perl
    Replies:
    0
    Views:
    1,744
    Scott Lander
    Jul 7, 2003
  2. Dave
    Replies:
    1
    Views:
    342
    Leor Zolman
    Apr 8, 2004
  3. =?Utf-8?B?QXJ0?=

    Page inherting from .master - unexpected results

    =?Utf-8?B?QXJ0?=, May 26, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    364
    =?Utf-8?B?QXJ0?=
    May 26, 2006
  4. CK
    Replies:
    3
    Views:
    332
  5. Steven D'Aprano

    Unexpected timing results

    Steven D'Aprano, Feb 23, 2006, in forum: Python
    Replies:
    7
    Views:
    401
    Steven D'Aprano
    Feb 24, 2006
Loading...

Share This Page