def main(): win = GraphWin("Tetrominoes", 200, 150) #block = Block(Point(1, 1), 'red') #block.draw(win) #shape = I_shape(Point(3, 1)) shape = Shape([1, 2], 'red') shape.draw(win) win.mainloop()
def main(): win = GraphWin("An Awesome Car", 700, 300) car = Car(Point(50, 50), 15, Point(100, 50), 15, 40) car.set_color('black', 'gray', 'pink') car.draw(win) win.mainloop()
def main(): win = GraphWin("Tetrominoes", 900, 150) tetrominoes = [ I_shape, J_shape, L_shape, O_shape, S_shape, T_shape, Z_shape ] x = 3 for tetromino in tetrominoes: shape = tetromino(Point(x, 1)) shape.draw(win) x += 4 win.mainloop() win.mainloop()
def main(): # create a window with width = 700 and height = 500 new_win = GraphWin('Wheel', 700, 500) # What we'll need for the wheel... wheel_center = Point(200, 200) # The wheel center is a Point at (200, 200) tire_radius = 100 # The radius of the outer tire is 100 # Make a wheel object new_wheel = Wheel(wheel_center, 0.6*tire_radius, tire_radius) # Set its color new_wheel.set_color('OliveDrab1', 'Pink') # And finally, draw it new_wheel.draw(new_win) new_wheel.animate(new_win, 1, 0, 100) # Run the window loop (must be the *last* line in your code) new_win.mainloop()
def main(): new_win = GraphWin("A Car", 700, 300) # 1st wheel centered at 50,50 with radius 15 wheel_center_1 = Point(50, 50) wheel_radius_1 = 15 tire_radius_1 = 0.6 * tire_radius_1 # 2nd wheel centered at 100,50 with radius 15 wheel_center_2 = Point(100, 50) wheel_radius_2 = 15 tire_radius_2 = 0.6 * tire_radius_1 # rectangle with a height of 40 upper_left_point = Point(15, 55) bottom_right_point = Point(75, 15) wheel_1 = Wheel(wheel_center_1, 0.6 * tire_radius_1, tire_radius_1) wheel_2 = Wheel(wheel_center_2, 0.6 * tire_radius_2, tire_radius_2) body = Rectangle(upper_left_point, bottom_right_point) # Set its color wheel_1.set_color('OliveDrab1', 'Pink') wheel_2.set_color('OliveDrab1', 'Pink') body.setFill('Blue') # And finally, draw it wheel_1.draw(new_win) wheel_2.draw(new_win) body.draw(new_win) car1 = Car(wheel_1, wheel_2, body) car1.draw(new_win) # make the car move on the screen car1.animate(new_win, 1, 0, 400) new_win.mainloop()