def sierpinski_triangle(order, length, upper_left_x, upper_left_y): """ :param order: :param length: :param upper_left_x: :param upper_left_y: :return: """ if order == 0: return else: tri1 = GLine(upper_left_x, upper_left_y, upper_left_x + length, upper_left_y) tri1.color = 'mediumblue' tri2 = GLine(upper_left_x, upper_left_y, upper_left_x + length / 2, upper_left_y + length * t_h) tri2.color = 'steelblue' tri3 = GLine(upper_left_x + length, upper_left_y, upper_left_x + length / 2, upper_left_y + length * t_h) tri3.color = 'dodgerblue' window.add(tri1) window.add(tri2) window.add(tri3) # Upper left triangle. sierpinski_triangle(order - 1, length / 2, upper_left_x, upper_left_y) # Upper right triangle. sierpinski_triangle(order - 1, length / 2, upper_left_x + length / 2, upper_left_y) # Middle bottom triangle. sierpinski_triangle(order - 1, length / 2, upper_left_x + length / 4, upper_left_y + length * t_h / 2) pause(PAUSE)
def sierpinski_triangle(order, length, upper_left_x, upper_left_y): """ :param order: the runs of recursion will be done :param length: Sierpinski Triangle's length :param upper_left_x: x position of the upper left Sierpinski Triangle :param upper_left_y: x position of the upper left Sierpinski Triangle :return: base case """ if order == 0: return else: # create the first order triangle line1 = GLine(upper_left_x, upper_left_y, upper_left_x + length, upper_left_y) line2 = GLine(upper_left_x, upper_left_y, upper_left_x + length / 2, upper_left_y + length * 0.866) line3 = GLine(upper_left_x + length, upper_left_y, upper_left_x + length / 2, upper_left_y + length * 0.866) line1.color = 'magenta' line2.color = 'magenta' line3.color = 'magenta' window.add(line1) window.add(line2) window.add(line3) # upper left sierpinski_triangle(order - 1, length / 2, upper_left_x, upper_left_y) # upper right sierpinski_triangle(order - 1, length / 2, upper_left_x + length / 2, upper_left_y) # lower one sierpinski_triangle(order - 1, length / 2, upper_left_x + length / 4, upper_left_y + length * 0.866 / 2)
def grid_line(self, size=50, dx=0, dy=0): """ 功能:輔助功能,方格線 size = 單位方格大小 dx = x軸位移量 dy = y軸位移量 """ line_color = 'lightgray' # 水平輔助線 for r in range(self.window.width // size + 1): p1_x = r * size + dx p1_y = 0 p2_x = r * size + dx p2_y = self.window.height line_row = GLine(p1_x, p1_y, p2_x, p2_y) line_row.color = line_color self.window.add(line_row) # 垂直輔助線 for c in range(self.window.height // size + 1): p1_x = 0 p1_y = c * size + dy p2_x = self.window.width p2_y = c * size + dy line_column = GLine(p1_x, p1_y, p2_x, p2_y) line_column.color = line_color self.window.add(line_column)
def lines(): """ Draw lines from each side to center, alternating fade in each segment to create pattern. :return: Nothing. """ for i in range(0, SEGMENTS * SIDES): # Start loop for total segments. for x in range(0, LINES): # Start loop for lines in segment. if i // SEGMENTS == 0: # Top side start points: x increment, y at top. start_x = i % SEGMENTS * LINES + x # Increment starts after adding prior segment. start_y = 0 elif i // SEGMENTS == 1: # Right side start points: x at right, y increment. start_x = window.width start_y = i % SEGMENTS * LINES + x elif i // SEGMENTS == 2: # Bottom side start points: x decrement, y bottom. start_x = window.width - (i % SEGMENTS * LINES + x) # Decrements by subtracting from edge. start_y = window.height elif i // SEGMENTS == 3: # Left side start points: x at left, y decrement. start_x = 0 start_y = window.height - (i % SEGMENTS * LINES + x) end_x = center_x # End points for line fixed at canvas center. end_y = center_y if i % 2 == 1: # Odd segments increment rgb values rgb = x * INCREMENT else: # Even segments decrement instead rgb = LINES * INCREMENT - x * INCREMENT line = GLine(start_x, start_y, end_x, end_y) line.color = GColor(rgb, rgb, rgb) window.add(line) return
def build_game_over(self): """ This method builds the 'Game Over' scene """ # delete the score line = GLine(4, self.window.height - 18, 12 + self.score_sign.width, self.window.height - 18) line.color = 'crimson' self.window.add(line) # Clean up self.window.remove(self.reward) self.window.remove(self.hint_sign) # Build up the 'Game Over' sign self.game_over_w.font = "Mamelon-35" self.game_over_w.color = 'midnightblue' self.window.add(self.game_over_w, x=(self.window.width - self.game_over_w.width) / 2, y=self.window.height / 2) # Create the movement of the 'Game Over' sign speed = self.__dy while True: self.game_over_w.move(0, speed) speed += 0.5 if self.game_over_w.y >= self.window.height * 2 // 3: speed *= -0.7 pause(10)
def sierpinski_triangle(order, length, upper_left_x, upper_left_y): """ :param order: the number of current triangle; if reach 0, then stop drawing triangles. :param length: the side length of the triangle :param upper_left_x: the x position of the upper left point of the triangle :param upper_left_y: the y position of the upper left point of the triangle :return: if 'order' reach zero, then return """ if order == 0: return else: # draw the triangle tri_1 = GLine(upper_left_x, upper_left_y, upper_left_x + length, upper_left_y) tri_2 = GLine(upper_left_x + length, upper_left_y, upper_left_x + length / 2, upper_left_y + length * 0.866) tri_3 = GLine(upper_left_x, upper_left_y, upper_left_x + length / 2, upper_left_y + length * 0.866) tri_1.color = 'darkslategrey' tri_2.color = 'darkslategrey' tri_3.color = 'darkslategrey' window.add(tri_1) window.add(tri_2) window.add(tri_3) # change the length previous_length = length length /= 2 # recursive triangle # upper right triangle sierpinski_triangle(order - 1, length, upper_left_x, upper_left_y) # upper left triangle sierpinski_triangle(order - 1, length, upper_left_x + previous_length / 2, upper_left_y) # below triangle sierpinski_triangle(order - 1, length, upper_left_x + previous_length / 4, upper_left_y + 0.866 * length)
def draw_line(point): global first_point_x, first_point_y, first_hole if first_point_x == 0 & first_point_y == 0: first_hole = GOval(SIZE, SIZE, x=point.x - SIZE/2, y=point.y - SIZE/2) #圈圈在中間 window.add(first_hole) first_point_x = point.x first_point_y = point.y else: line = GLine(first_point_x,first_point_y,point.x,point.y) window.add(line) line.color = random_color() window.remove(first_hole) first_point_x = 0 first_point_y = 0
def Louvre(): """ This function will draw the Louvre museum. """ # Louvre museum's body body = GRect(400, 300, x=0, y=520) body.filled = True body.fill_color = 'white' body.color = 'white' window.add(body) # to cut the body into triangle for i in range(200): l_cut = GRect(200-i, 1.5, x=0, y=520+i*1.4) l_cut.filled = True l_cut.fill_color = 'dark_blue' l_cut.color = 'dark_blue' window.add(l_cut) for i in range(200): l_cut = GRect(200-i, 1.5, x=200+i, y=520+i*1.4) l_cut.filled = True l_cut.fill_color = 'dark_blue' l_cut.color = 'dark_blue' window.add(l_cut) for i in range(8): left_line=GLine(20*i, 800-(40*i), i*50, 800) left_line.color='dark_blue' window.add(left_line) for i in range(8): right_line = GLine(45 *(i+1), 800, 230+i*30, 550+i*10) right_line.color = 'dark_blue' window.add(right_line) # to cover the line that out of the range rect= GRect(40, 110, x=401, y=600) rect.filled = True rect.fill_color = 'white' rect.color = 'white' window.add(rect)
def point(a): global count global f_x global f_y global click1 count += 1 if count % 2 == 1: window.add(click1, x=a.x - click1.width / 2, y=a.y - click1.height / 2) f_x = a.x f_y = a.y else: b_line = GLine(f_x, f_y, a.x, a.y) b_line.color = 'black' window.add(b_line) window.remove(click1)
def sierpinski_triangle(order, length, upper_left_x, upper_left_y): """ :param order: The number of orders/layers that the fractal will be structure :param length: The length of each side of triangle :param upper_left_x: The x-axis representing the upper-left starting point of the triangle :param upper_left_y: The y-axis representing the upper-left starting point of the triangle :return: """ h_triangle = length * 0.866 # This is the height of the triangle c_triangle = length * 0.5 # This is the width of the triangle from any angle to its center point down_x = 0.5 * length / 2 + upper_left_x # This is the x-axis of center down triangle down_y = 0.866 * length / 2 + upper_left_y # This is the y-axis of center down triangle if order == 0: return else: # pinpoint the starting point of left triangle sierpinski_triangle(order - 1, length / 2, upper_left_x, upper_left_y) # pinpoint the starting point of upper right triangle sierpinski_triangle(order - 1, length / 2, upper_left_x + length / 2, upper_left_y) # pinpoint the starting point of center down triangle sierpinski_triangle(order - 1, length / 2, down_x, down_y) # draw each side of triangle line_1 = GLine(upper_left_x, upper_left_y, upper_left_x + length, upper_left_y) line_1.color = 'black' line_2 = GLine(upper_left_x, upper_left_y, upper_left_x + c_triangle, upper_left_y + h_triangle) line_2.color = 'red' line_3 = GLine(upper_left_x + c_triangle, upper_left_y + h_triangle, upper_left_x + length, upper_left_y) line_3.color = 'blue' window.add(line_1) window.add(line_2) window.add(line_3) pause(DELAY)
def main(): """ """ # create a window. window = GWindow(width=1000, height=700, title='work station') # draw the screen side of my laptop. top_case = GRect(300, 200, x=350, y=100) top_case.filled = True top_case.fill_color = 'black' window.add(top_case) screen = GRect(280, 175, x=360, y=110) screen.filled = True screen.fill_color = 'silver' window.add(screen) # drawing keyboard and trackpad side of my laptop. c__side_left = GLine(350, 300, 250, 460) window.add(c__side_left) c_side_right = GLine(650, 300, 750, 460) window.add(c_side_right) c_side_bottom = GLine(250, 460, 750, 460) window.add(c_side_bottom) keyboard_left = GLine(360, 310, 317, 380) window.add(keyboard_left) keyboard_right = GLine(640, 310, 682, 380) window.add(keyboard_right) keyboard_up = GLine(360, 310, 640, 310) window.add(keyboard_up) keyboard_down = GLine(317, 380, 682, 380) window.add(keyboard_down) keyboard = GRect(280, 70) keyboard.filled = True keyboard.fill_color = 'black' window.add(keyboard, 360, 310) # making my keyboard look like a garbage can :) for i in range(360, 640, 31): grid_verti = GLine(i, 310, i, 380) grid_verti.color = 'silver' window.add(grid_verti) for i in range(310, 380, 15): grid_hori = GLine(360, i, 640, i) grid_hori.color = 'silver' window.add(grid_hori) # drawing track pad. pad_up = GLine(430, 390, 571, 390) pad_down = GLine(392, 450, 608, 450) pad_left = GLine(430, 390, 392, 450) pad_right = GLine(571, 390, 608, 450) window.add(pad_up) window.add(pad_down) window.add(pad_left) window.add(pad_right) # adding thickness to my laptop. edge_bottom = GRect(500, 10, x=250, y=460) edge_bottom.filled = True edge_bottom.fill_color = 'silver' window.add(edge_bottom) # put on mackbook pro logo. mbplogo = GLabel('MacBook Pro') mbplogo.font = '-10' mbplogo.color = 'silver' window.add(mbplogo, 465, 298) # create labels. GI = GLabel('Garbage In') GO = GLabel('Garbage Out') GI.font = '-50' GO.font = '-50' window.add(GI, 50, 320) window.add(GO, 700, 320) # draw 5 circles symbolize garbage Garbage_1 = GOval(20, 20) Garbage_1.filled = True Garbage_1.fill_color = 'red' window.add(Garbage_1, 320, 270) Garbage_2 = GOval(20, 20) Garbage_2.filled = True Garbage_2.fill_color = 'green' window.add(Garbage_2, 400, 320) Garbage_3 = GOval(20, 20) Garbage_3.filled = True Garbage_3.fill_color = 'blue' window.add(Garbage_3, 670, 270) Garbage_4 = GOval(20, 20) Garbage_4.filled = True Garbage_4.fill_color = 'yellow' window.add(Garbage_4, 585, 300) Garbage_5 = GOval(20, 20) Garbage_5.filled = True Garbage_5.fill_color = 'magenta' window.add(Garbage_5, 510, 340)
def main(): """ A stock trading apps screen. Dream come True! Hope I won't see this terrible scene on my phone in my lifetime .... """ top_line = GRect(450, 20, x=0, y=0) top_line.filled = True top_line.color = 'darkblue' top_line.fill_color = 'darkblue' window.add(top_line) time_label = GLabel(' 下午 1:30 ') time_label.font = 'Courier-14' time_label.color = 'white' window.add(time_label, 10, 22) power_label = GLabel(' 10% ') power_label.font = 'Helvetica-14' power_label.color = 'white' window.add(power_label, 400, 22) power = GRect(10, 15, x=390, y=3) power.filled = True power.color = 'red' power.fill_color = 'red' window.add(power) tool_bar = GRect(450, 35, x=0, y=21) tool_bar.filled = True tool_bar.color = 'black' tool_bar.fill_color = 'black' window.add(tool_bar) tool_bar_label = GLabel(' 下單 委託 明細 庫存 帳務 ') tool_bar_label.font = 'Courier-18' tool_bar_label.color = 'white' window.add(tool_bar_label, 30, 55) find_mark = GOval(25, 25, x=410, y=25) find_mark.filled = False find_mark.color = 'white' window.add(find_mark) find_mark_2 = GLine(435, 45, 445, 55) find_mark_2.filled = False find_mark_2.color = 'white' window.add(find_mark_2) tool_bar_tri = GPolygon() tool_bar_tri.add_vertex((15, 40)) tool_bar_tri.add_vertex((30, 50)) tool_bar_tri.add_vertex((30, 30)) tool_bar_tri.filled = True tool_bar_tri.fill_color = 'white' window.add(tool_bar_tri) mid_up = GRect(450, 200, x=0, y=56) mid_up.filled = True mid_up.color = 'black' mid_up.fill_color = 'black' window.add(mid_up) account = GRect(250, 35, x=10, y=56) account.filled = False account.color = 'white' window.add(account) account_label = GLabel(' 證878787-66666') account_label.font = 'Courier-18' account_label.color = 'white' window.add(account_label, 10, 90) account_tri = GPolygon() account_tri.add_vertex((240, 85)) account_tri.add_vertex((250, 65)) account_tri.add_vertex((230, 65)) account_tri.filled = True account_tri.fill_color = 'white' window.add(account_tri) account_r = GRect(150, 35, x=280, y=56) account_r.filled = False account_r.color = 'white' window.add(account_r) account_label_r = GLabel(' 現股 ') account_label_r.font = 'Courier-18' account_label_r.color = 'white' window.add(account_label_r, 330, 90) account_tri_r = GPolygon() account_tri_r.add_vertex((410, 85)) account_tri_r.add_vertex((420, 65)) account_tri_r.add_vertex((400, 65)) account_tri_r.filled = True account_tri_r.fill_color = 'white' window.add(account_tri_r) payback_mark = GOval(120, 120, x=50, y=105) payback_mark.filled = True payback_mark.fill_color = 'limegreen' payback_mark.color = 'limegreen' window.add(payback_mark) payback_mark2 = GOval(100, 100, x=60, y=115) payback_mark2.filled = True payback_mark2.fill_color = 'black' window.add(payback_mark2) payback_label = GLabel('股票報酬') payback_label.font = 'Courier-13' payback_label.color = 'white' window.add(payback_label, 75, 160) payback_label2 = GLabel('-100%') payback_label2.font = 'Courier-15' payback_label2.color = 'limegreen' window.add(payback_label2, 80, 190) payback_worth = GLabel('股票市值 0') payback_worth.font = 'Courier-16' payback_worth.color = 'white' window.add(payback_worth, 200, 130) payback_cost = GLabel('總成本 2,000,000') payback_cost.font = 'Courier-16' payback_cost.color = 'white' window.add(payback_cost, 200, 170) coin_style = GLabel('(幣別:新台幣)') coin_style.font = 'Courier-12' coin_style.color = 'white' window.add(coin_style, 330, 200) counting = GRect(110, 35, x=200, y=210) counting.filled = True counting.fill_color = 'darkblue' counting.color = 'white' window.add(counting) searching = GRect(110, 35, x=320, y=210) searching.filled = True searching.fill_color = 'darkblue' searching.color = 'white' window.add(searching) counting_label = GLabel('當沖試算') counting_label.font = 'Courier-16' counting_label.color = 'white' window.add(counting_label, 213, 240) searching_label = GLabel('維持率試算') searching_label.font = 'Courier-15' searching_label.color = 'white' window.add(searching_label, 323, 240) real_payback = GLabel('報酬 -2,000,000') real_payback.font = 'Courier-12' real_payback.color = 'limegreen' window.add(real_payback, 40, 250) mid_blue_bar = GRect(450, 50, x=0, y=256) mid_blue_bar.filled = True mid_blue_bar.fill_color = 'midnightblue' mid_blue_bar.color = 'blue' window.add(mid_blue_bar) mid_blue_label = GLabel(' 名稱 市/均 股數/可下單數 損益') mid_blue_label.font = 'cCourier-20' mid_blue_label.color = 'white' window.add(mid_blue_label, 0, 295) first = GRect(450, 80, x=0, y=306) first.filled = True first.fill_color = 'black' first.color = 'blue' window.add(first) first_label_1 = GLabel(' 台G電 0.0000 400 ') first_label_1.font = 'cCourier-18' first_label_1.color = 'white' window.add(first_label_1, 0, 345) first_label_r1 = GLabel('-400,000') first_label_r1.font = 'cCourier-18' first_label_r1.color = 'limegreen' window.add(first_label_r1, 360, 345) first_label_2 = GLabel(' 現股 1000.0 400 ') first_label_2.font = 'cCourier-18' first_label_2.color = 'white' window.add(first_label_2, 0, 375) first_label_r2 = GLabel('-100.00%') first_label_r2.font = 'cCourier-18' first_label_r2.color = 'limegreen' window.add(first_label_r2, 360, 375) second = GRect(450, 80, x=0, y=386) second.filled = True second.fill_color = 'black' second.color = 'blue' window.add(second) second_label_1 = GLabel(' 大綠光 0.0000 400 ') second_label_1.font = 'cCourier-18' second_label_1.color = 'white' window.add(second_label_1, 0, 425) second_label_r1 = GLabel('-400,000') second_label_r1.font = 'cCourier-18' second_label_r1.color = 'limegreen' window.add(second_label_r1, 360, 425) second_label_2 = GLabel(' 現股 1000.0 400 ') second_label_2.font = 'cCourier-18' second_label_2.color = 'white' window.add(second_label_2, 0, 455) second_label_r2 = GLabel('-100.00%') second_label_r2.font = 'cCourier-18' second_label_r2.color = 'limegreen' window.add(second_label_r2, 360, 455) third = GRect(450, 80, x=0, y=466) third.filled = True third.fill_color = 'black' third.color = 'blue' window.add(third) third_label_1 = GLabel(' 連發哥 0.0000 400 ') third_label_1.font = 'cCourier-18' third_label_1.color = 'white' window.add(third_label_1, 0, 505) third_label_r1 = GLabel('-400,000') third_label_r1.font = 'cCourier-18' third_label_r1.color = 'limegreen' window.add(third_label_r1, 360, 505) third_label_2 = GLabel(' 現股 1000.0 400 ') third_label_2.font = 'cCourier-18' third_label_2.color = 'white' window.add(third_label_2, 0, 535) third_label_r2 = GLabel('-100.00%') third_label_r2.font = 'cCourier-18' third_label_r2.color = 'limegreen' window.add(third_label_r2, 360, 535) four = GRect(450, 80, x=0, y=546) four.filled = True four.fill_color = 'black' four.color = 'blue' window.add(four) four_label_1 = GLabel(' 海公公 0.0000 400 ') four_label_1.font = 'cCourier-18' four_label_1.color = 'white' window.add(four_label_1, 0, 585) four_label_r1 = GLabel('-400,000') four_label_r1.font = 'cCourier-18' four_label_r1.color = 'limegreen' window.add(four_label_r1, 360, 585) four_label_2 = GLabel(' 現股 1000.0 400 ') four_label_2.font = 'cCourier-18' four_label_2.color = 'white' window.add(four_label_2, 0, 615) four_label_r2 = GLabel('-100.00%') four_label_r2.font = 'cCourier-18' four_label_r2.color = 'limegreen' window.add(four_label_r2, 360, 615) fifth = GRect(450, 80, x=0, y=626) fifth.filled = True fifth.fill_color = 'black' fifth.color = 'blue' window.add(fifth) fifth_label_1 = GLabel(' 種花電 0.0000 400 ') fifth_label_1.font = 'cCourier-18' fifth_label_1.color = 'white' window.add(fifth_label_1, 0, 665) fifth_label_r1 = GLabel('-400,000') fifth_label_r1.font = 'cCourier-18' fifth_label_r1.color = 'limegreen' window.add(fifth_label_r1, 360, 665) fifth_label_2 = GLabel(' 現股 1000.0 400 ') fifth_label_2.font = 'cCourier-18' fifth_label_2.color = 'white' window.add(fifth_label_2, 0, 695) fifth_label_r2 = GLabel('-100.00%') fifth_label_r2.font = 'cCourier-18' fifth_label_r2.color = 'limegreen' window.add(fifth_label_r2, 360, 695) final = GRect(450, 200, x=0, y=707) final.filled = True final.fill_color = 'black' final.color = 'black' window.add(final) bot = GRect(450, 50, x=0, y=857) bot.filled = True bot.fill_color = 'darkgrey' bot.color = 'gray' window.add(bot) bot_tri = GPolygon() bot_tri.add_vertex((100, 890)) bot_tri.add_vertex((80, 880)) bot_tri.add_vertex((100, 870)) bot_tri.filled = False bot_tri.color = 'white' bot_tri.fill_color = 'white' window.add(bot_tri) bot_oval = GOval(25, 25, x=207, y=868) bot_oval.filled = False bot_oval.color = 'white' bot_oval.fill_color = 'white' window.add(bot_oval) bot_rect = GRect(20, 20, x=347, y=870) bot_rect.filled = False bot_rect.color = 'white' bot_rect.fill_color = 'white' window.add(bot_rect) house_tri = GPolygon() house_tri.add_vertex((20, 835)) house_tri.add_vertex((50, 835)) house_tri.add_vertex((35, 820)) house_tri.filled = True house_tri.fill_color = 'white' window.add(house_tri) house_rect1 = GRect(8, 13, x=25, y=835) house_rect1.filled = True house_rect1.fill_color = 'white' window.add(house_rect1) house_rect2 = GRect(8, 13, x=36, y=835) house_rect2.filled = True house_rect2.fill_color = 'white' window.add(house_rect2) house_label = GLabel(' 選股 自選 交易 行情 專家') house_label.font = 'cCourier-18' house_label.color = 'white' window.add(house_label, 80, 850) warn = GLabel('*注意事項*') warn.font = 'cCourier-15' warn.color = 'white' window.add(warn, 10, 810) warn_line = GLabel('*投資一定有風險,基金投資幾乎穩賠,申購前應詳閱公開說明書。*') warn_line.font = 'cCourier-8' warn_line.color = 'white' window.add(warn_line, 120, 805)
def main(): """ I draw my favorite NBA player, Stephen Curry, to celebrate his second winning in the 3-Point Contest. In addition, I am extremely happy to see Curry playing on the court again after last year's injury. """ window = GWindow(600, 800, title='Stephen Curry') # Background background = GRect(window.width, window.height) background.filled = True background.fill_color = 'royalblue' background.color = 'royalblue' window.add(background) # Title label = GLabel('STEPHEN CURRY') label.color = 'gold' label.font = 'Times New Roman-50-bold' window.add(label, (window.width - label.width) / 2, 100) # Floor floor = GRect(window.width, 130) floor.filled = True floor.fill_color = 'moccasin' floor.color = 'wheat' window.add(floor, 0, 670) # Stephen Curry # Shadow c_shadow = GOval(180, 20) c_shadow.filled = True c_shadow.fill_color = 'gray' c_shadow.color = 'gray' window.add(c_shadow, 251, 740) # Right Shoe right_shoe_bottom = GPolygon() right_shoe_bottom.add_vertex((320, 742)) right_shoe_bottom.add_vertex((320, 747)) right_shoe_bottom.add_vertex((370, 730)) right_shoe_bottom.add_vertex((378, 728)) right_shoe_bottom.add_vertex((380, 720)) right_shoe_bottom.add_vertex((376, 715)) right_shoe_bottom.filled = True right_shoe_bottom.fill_color = 'snow' right_shoe_bottom.color = 'navy' window.add(right_shoe_bottom) right_shoe_head = GOval(21, 13) right_shoe_head.filled = True right_shoe_head.fill_color = 'snow' right_shoe_head.color = 'navy' window.add(right_shoe_head, 305, 735) right_shoe = GPolygon() right_shoe.add_vertex((338, 700)) right_shoe.add_vertex((340, 715)) right_shoe.add_vertex((313, 735)) right_shoe.add_vertex((310, 743)) right_shoe.add_vertex((320, 746)) right_shoe.add_vertex((365, 725)) right_shoe.add_vertex((376, 715)) right_shoe.add_vertex((362, 693)) right_shoe.filled = True right_shoe.fill_color = 'snow' right_shoe.color = 'snow' window.add(right_shoe) shoelace1 = GPolygon() shoelace1.add_vertex((330, 723)) shoelace1.add_vertex((340, 717)) shoelace1.add_vertex((340, 709)) shoelace1.add_vertex((337, 717)) shoelace1.filled = True shoelace1.fill_color = 'navy' shoelace1.color = 'navy' window.add(shoelace1) r_shoe_line1 = GLine(x0=327, x1=328, y0=733, y1=737) r_shoe_line1.color = 'navy' window.add(r_shoe_line1) r_shoe_line2 = GLine(x0=330, x1=334, y0=730, y1=735) r_shoe_line2.color = 'navy' window.add(r_shoe_line2) r_shoe_detail1 = GLine(x0=307, x1=321, y0=746, y1=743) r_shoe_detail1.color = 'navy' window.add(r_shoe_detail1) r_shoe_detail2 = GLine(x0=321, x1=379, y0=743, y1=719) r_shoe_detail2.color = 'navy' window.add(r_shoe_detail2) r_shoe_detail3 = GPolygon() r_shoe_detail3.add_vertex((353, 705)) r_shoe_detail3.add_vertex((355, 708)) r_shoe_detail3.add_vertex((357, 716)) r_shoe_detail3.filled = True r_shoe_detail3.fill_color = 'navy' r_shoe_detail3.color = 'navy' window.add(r_shoe_detail3) r_shoe_detail4 = GPolygon() r_shoe_detail4.add_vertex((356, 701)) r_shoe_detail4.add_vertex((358, 704)) r_shoe_detail4.add_vertex((359, 710)) r_shoe_detail4.filled = True r_shoe_detail4.fill_color = 'navy' r_shoe_detail4.color = 'navy' window.add(r_shoe_detail4) r_shoe_detail5 = GLine(x0=315, x1=338, y0=744, y1=732) r_shoe_detail5.color = 'navy' window.add(r_shoe_detail5) r_shoe_detail6 = GLine(x0=338, x1=361, y0=732, y1=718) r_shoe_detail6.color = 'navy' window.add(r_shoe_detail6) r_shoe_detail7 = GLine(x0=361, x1=374, y0=718, y1=714) r_shoe_detail7.color = 'navy' window.add(r_shoe_detail7) r_outline1 = GLine(x0=338, x1=340, y0=700, y1=715) r_outline1.color = 'navy' window.add(r_outline1) r_outline2 = GLine(x0=340, x1=313, y0=715, y1=735) r_outline2.color = 'navy' window.add(r_outline2) r_outline3 = GLine(x0=376, x1=362, y0=716, y1=693) r_outline3.color = 'navy' window.add(r_outline3) # Right Leg right_ankle = GPolygon() right_ankle.add_vertex((338, 700)) right_ankle.add_vertex((362, 693)) right_ankle.add_vertex((353, 680)) right_ankle.add_vertex((344, 662)) right_ankle.add_vertex((321, 672)) right_ankle.add_vertex((335, 688)) right_ankle.filled = True right_ankle.fill_color = 'snow' right_ankle.color = 'navy' window.add(right_ankle) r_sock1 = GLine(x0=327, x1=333, y0=674, y1=681) r_sock1.color = 'navy' window.add(r_sock1) r_sock2 = GLine(x0=330, x1=335, y0=673, y1=679) r_sock2.color = 'navy' window.add(r_sock2) r_sock3 = GLine(x0=333, x1=340, y0=672, y1=680) r_sock3.color = 'navy' window.add(r_sock3) r_protect = GPolygon() r_protect.add_vertex((337, 701)) r_protect.add_vertex((335, 693)) r_protect.add_vertex((338, 686)) r_protect.add_vertex((355, 680)) r_protect.add_vertex((362, 692)) r_protect.filled = True r_protect.fill_color = 'snow' r_protect.color = 'navy' window.add(r_protect) right_calf = GPolygon() right_calf.add_vertex((322, 672)) right_calf.add_vertex((343, 662)) right_calf.add_vertex((338, 648)) right_calf.add_vertex((313, 660)) right_calf.filled = True right_calf.fill_color = 'peru' right_calf.color = 'navy' window.add(right_calf) right_thigh = GPolygon() right_thigh.add_vertex((280, 596)) right_thigh.add_vertex((275, 615)) right_thigh.add_vertex((300, 610)) right_thigh.add_vertex((313, 610)) right_thigh.add_vertex((313, 598)) right_thigh.filled = True right_thigh.fill_color = 'navy' right_thigh.color = 'navy' window.add(right_thigh) right_knee = GPolygon() right_knee.add_vertex((275, 615)) right_knee.add_vertex((273, 625)) right_knee.add_vertex((275, 630)) right_knee.add_vertex((287, 643)) right_knee.add_vertex((297, 645)) right_knee.add_vertex((313, 660)) right_knee.add_vertex((338, 648)) right_knee.add_vertex((334, 640)) right_knee.add_vertex((314, 618)) right_knee.add_vertex((313, 611)) right_knee.add_vertex((300, 610)) right_knee.filled = True right_knee.fill_color = 'snow' right_knee.color = 'navy' window.add(right_knee) r_knee_line1 = GPolygon() r_knee_line1.add_vertex((290, 629)) r_knee_line1.add_vertex((297, 627)) r_knee_line1.add_vertex((308, 621)) r_knee_line1.filled = True r_knee_line1.fill_color = 'navy' r_knee_line1.color = 'navy' window.add(r_knee_line1) r_knee_line2 = GPolygon() r_knee_line2.add_vertex((294, 623)) r_knee_line2.add_vertex((302, 621)) r_knee_line2.add_vertex((306, 619)) r_knee_line2.filled = True r_knee_line2.fill_color = 'navy' r_knee_line2.color = 'navy' window.add(r_knee_line2) r_knee_line3 = GPolygon() r_knee_line3.add_vertex((299, 632)) r_knee_line3.add_vertex((308, 627)) r_knee_line3.add_vertex((309, 625)) r_knee_line3.filled = True r_knee_line3.fill_color = 'navy' r_knee_line3.color = 'navy' window.add(r_knee_line3) r_knee_line4 = GPolygon() r_knee_line4.add_vertex((316, 654)) r_knee_line4.add_vertex((322, 650)) r_knee_line4.add_vertex((330, 647)) r_knee_line4.filled = True r_knee_line4.fill_color = 'navy' r_knee_line4.color = 'navy' window.add(r_knee_line4) # Left Shoe left_shoe_head = GOval(28, 15) left_shoe_head.filled = True left_shoe_head.fill_color = 'snow' left_shoe_head.color = 'navy' window.add(left_shoe_head, 176, 737) left_shoe = GPolygon() left_shoe.add_vertex((195, 752)) left_shoe.add_vertex((253, 752)) left_shoe.add_vertex((261, 750)) left_shoe.add_vertex((256, 730)) left_shoe.add_vertex((258, 715)) left_shoe.add_vertex((236, 716)) left_shoe.add_vertex((233, 712)) left_shoe.add_vertex((217, 727)) left_shoe.add_vertex((185, 738)) left_shoe.add_vertex((180, 745)) left_shoe.filled = True left_shoe.fill_color = 'snow' left_shoe.color = 'snow' window.add(left_shoe) shoelace = GPolygon() shoelace.add_vertex((205, 733)) shoelace.add_vertex((209, 738)) shoelace.add_vertex((209, 732)) shoelace.add_vertex((216, 736)) shoelace.add_vertex((215, 728)) shoelace.add_vertex((223, 732)) shoelace.add_vertex((222, 723)) shoelace.add_vertex((230, 730)) shoelace.add_vertex((225, 719)) shoelace.add_vertex((233, 721)) shoelace.add_vertex((230, 717)) shoelace.filled = True shoelace.fill_color = 'snow' shoelace.color = 'navy' window.add(shoelace) l_shoe_line1 = GPolygon() l_shoe_line1.add_vertex((247, 720)) l_shoe_line1.add_vertex((243, 727)) l_shoe_line1.add_vertex((245, 725)) l_shoe_line1.filled = True l_shoe_line1.fill_color = 'navy' l_shoe_line1.color = 'navy' window.add(l_shoe_line1) l_shoe_line2 = GLine(x0=251, x1=250, y0=720, y1=724) l_shoe_line2.color = 'navy' window.add(l_shoe_line2) l_shoe_detail1 = GLine(x0=233, x1=230, y0=718, y1=730) l_shoe_detail1.color = 'navy' window.add(l_shoe_detail1) l_shoe_detail2 = GLine(x0=231, x1=205, y0=730, y1=739) l_shoe_detail2.color = 'navy' window.add(l_shoe_detail2) l_shoe_detail3 = GLine(x0=176, x1=191, y0=745, y1=749) l_shoe_detail3.color = 'navy' window.add(l_shoe_detail3) l_shoe_detail4 = GLine(x0=191, x1=259, y0=749, y1=745) l_shoe_detail4.color = 'navy' window.add(l_shoe_detail4) l_shoe_detail5 = GLine(x0=185, x1=191, y0=747, y1=744) l_shoe_detail5.color = 'navy' window.add(l_shoe_detail5) l_shoe_detail6 = GLine(x0=191, x1=202, y0=744, y1=745) l_shoe_detail6.color = 'navy' window.add(l_shoe_detail6) l_shoe_detail7 = GLine(x0=202, x1=243, y0=745, y1=736) l_shoe_detail7.color = 'navy' window.add(l_shoe_detail7) l_shoe_detail8 = GLine(x0=243, x1=258, y0=736, y1=738) l_shoe_detail8.color = 'navy' window.add(l_shoe_detail8) l_outline1 = GLine(x0=194, x1=250, y0=752, y1=752) l_outline1.color = 'navy' window.add(l_outline1) l_outline2 = GLine(x0=250, x1=261, y0=752, y1=750) l_outline2.color = 'navy' window.add(l_outline2) l_outline3 = GLine(x0=261, x1=256, y0=750, y1=730) l_outline3.color = 'navy' window.add(l_outline3) l_outline4 = GLine(x0=256, x1=258, y0=730, y1=715) l_outline4.color = 'navy' window.add(l_outline4) l_outline5 = GLine(x0=233, x1=217, y0=712, y1=727) l_outline5.color = 'navy' window.add(l_outline5) l_outline6 = GLine(x0=217, x1=184, y0=727, y1=738) l_outline6.color = 'navy' window.add(l_outline6) # Left Leg left_ankle = GPolygon() left_ankle.add_vertex((233, 712)) left_ankle.add_vertex((236, 716)) left_ankle.add_vertex((258, 715)) left_ankle.add_vertex((260, 697)) left_ankle.add_vertex((264, 679)) left_ankle.add_vertex((237, 677)) left_ankle.add_vertex((237, 697)) left_ankle.filled = True left_ankle.fill_color = 'snow' left_ankle.color = 'navy' window.add(left_ankle) l_protect = GPolygon() l_protect.add_vertex((233, 712)) l_protect.add_vertex((234, 698)) l_protect.add_vertex((244, 699)) l_protect.add_vertex((261, 702)) l_protect.add_vertex((260, 713)) l_protect.add_vertex((243, 716)) l_protect.filled = True l_protect.fill_color = 'snow' l_protect.color = 'navy' window.add(l_protect) l_sock1 = GLine(x0=252, x1=252, y0=687, y1=695) l_sock1.color = 'navy' window.add(l_sock1) l_sock2 = GLine(x0=255, x1=254, y0=685, y1=695) l_sock2.color = 'navy' window.add(l_sock2) l_sock3 = GLine(x0=259, x1=257, y0=683, y1=695) l_sock3.color = 'navy' window.add(l_sock3) left_calf1 = GPolygon() left_calf1.add_vertex((238, 677)) left_calf1.add_vertex((263, 679)) left_calf1.add_vertex((267, 662)) left_calf1.add_vertex((236, 660)) left_calf1.filled = True left_calf1.fill_color = 'peru' left_calf1.color = 'navy' window.add(left_calf1) lef_calf2 = GPolygon() lef_calf2.add_vertex((235, 660)) lef_calf2.add_vertex((268, 662)) lef_calf2.add_vertex((269, 650)) lef_calf2.add_vertex((268, 620)) lef_calf2.add_vertex((272, 613)) lef_calf2.add_vertex((233, 608)) lef_calf2.add_vertex((232, 620)) lef_calf2.add_vertex((237, 640)) lef_calf2.filled = True lef_calf2.fill_color = 'snow' lef_calf2.color = 'navy' window.add(lef_calf2) l_knee_line1 = GPolygon() l_knee_line1.add_vertex((242, 615)) l_knee_line1.add_vertex((250, 617)) l_knee_line1.add_vertex((261, 618)) l_knee_line1.filled = True l_knee_line1.fill_color = 'navy' l_knee_line1.color = 'navy' window.add(l_knee_line1) l_knee_line2 = GPolygon() l_knee_line2.add_vertex((245, 621)) l_knee_line2.add_vertex((248, 622)) l_knee_line2.add_vertex((260, 622)) l_knee_line2.filled = True l_knee_line2.fill_color = 'navy' l_knee_line2.color = 'navy' window.add(l_knee_line2) l_knee_line3 = GPolygon() l_knee_line3.add_vertex((249, 626)) l_knee_line3.add_vertex((252, 627)) l_knee_line3.add_vertex((259, 626)) l_knee_line3.filled = True l_knee_line3.fill_color = 'navy' l_knee_line3.color = 'navy' window.add(l_knee_line3) l_knee_line4 = GPolygon() l_knee_line4.add_vertex((243, 656)) l_knee_line4.add_vertex((249, 657)) l_knee_line4.add_vertex((263, 658)) l_knee_line4.filled = True l_knee_line4.fill_color = 'navy' l_knee_line4.color = 'navy' window.add(l_knee_line4) left_thigh = GPolygon() left_thigh.add_vertex((233, 608)) left_thigh.add_vertex((272, 613)) left_thigh.add_vertex((277, 598)) left_thigh.add_vertex((237, 593)) left_thigh.filled = True left_thigh.fill_color = 'navy' left_thigh.color = 'navy' window.add(left_thigh) # Shorts shorts = GPolygon() shorts.add_vertex((227, 590)) shorts.add_vertex((290, 598)) shorts.add_vertex((291, 596)) shorts.add_vertex((322, 596)) shorts.add_vertex((321, 560)) shorts.add_vertex((324, 540)) shorts.add_vertex((330, 520)) shorts.add_vertex((328, 475)) shorts.add_vertex((252, 478)) shorts.add_vertex((240, 515)) shorts.add_vertex((230, 580)) shorts.filled = True shorts.fill_color = 'snow' shorts.color = 'navy' window.add(shorts) line_1 = GPolygon() line_1.add_vertex((252, 505)) line_1.add_vertex((259, 485)) line_1.add_vertex((255, 495)) line_1.filled = True line_1.fill_color = 'navy' line_1.color = 'navy' window.add(line_1) line_2 = GPolygon() line_2.add_vertex((263, 495)) line_2.add_vertex((254, 525)) line_2.add_vertex((257, 513)) line_2.filled = True line_2.fill_color = 'navy' line_2.color = 'navy' window.add(line_2) line_3 = GPolygon() line_3.add_vertex((302, 485)) line_3.add_vertex((294, 525)) line_3.add_vertex((299, 504)) line_3.filled = True line_3.fill_color = 'navy' line_3.color = 'navy' window.add(line_3) line_4 = GPolygon() line_4.add_vertex((307, 502)) line_4.add_vertex((299, 538)) line_4.add_vertex((304, 519)) line_4.filled = True line_4.fill_color = 'navy' line_4.color = 'navy' window.add(line_4) stripe3 = GPolygon() stripe3.add_vertex((275, 478)) stripe3.add_vertex((263, 530)) stripe3.add_vertex((246, 592)) stripe3.add_vertex((253, 593)) stripe3.add_vertex((283, 478)) stripe3.filled = True stripe3.fill_color = 'gold' stripe3.color = 'navy' window.add(stripe3) stripe4 = GPolygon() stripe4.add_vertex((289, 478)) stripe4.add_vertex((260, 593)) stripe4.add_vertex((267, 595)) stripe4.add_vertex((295, 478)) stripe4.filled = True stripe4.fill_color = 'gold' stripe4.color = 'navy' window.add(stripe4) pattern1 = GPolygon() pattern1.add_vertex((227, 590)) pattern1.add_vertex((290, 598)) pattern1.add_vertex((293, 590)) pattern1.add_vertex((286, 565)) pattern1.add_vertex((283, 550)) pattern1.add_vertex((282, 537)) pattern1.add_vertex((270, 587)) pattern1.add_vertex((248, 583)) pattern1.add_vertex((262, 533)) pattern1.add_vertex((246, 555)) pattern1.add_vertex((232, 570)) pattern1.filled = True pattern1.fill_color = 'navy' pattern1.color = 'navy' window.add(pattern1) pattern2 = GPolygon() pattern2.add_vertex((292, 596)) pattern2.add_vertex((322, 596)) pattern2.add_vertex((321, 589)) pattern2.add_vertex((295, 590)) pattern2.filled = True pattern2.fill_color = 'navy' pattern2.color = 'navy' window.add(pattern2) shorts_line = GPolygon() shorts_line.add_vertex((291, 596)) shorts_line.add_vertex((310, 525)) shorts_line.add_vertex((307, 540)) shorts_line.filled = True shorts_line.fill_color = 'navy' shorts_line.color = 'navy' window.add(shorts_line) # Right Arm right_arm = GPolygon() right_arm.add_vertex((272, 344)) right_arm.add_vertex((237, 257)) right_arm.add_vertex((232, 250)) right_arm.add_vertex((215, 247)) right_arm.add_vertex((208, 241)) right_arm.add_vertex((208, 230)) right_arm.add_vertex((217, 228)) right_arm.add_vertex((203, 207)) right_arm.add_vertex((206, 204)) right_arm.add_vertex((223, 222)) right_arm.add_vertex((213, 198)) right_arm.add_vertex((216, 196)) right_arm.add_vertex((230, 218)) right_arm.add_vertex((223, 201)) right_arm.add_vertex((226, 199)) right_arm.add_vertex((245, 237)) right_arm.add_vertex((251, 245)) right_arm.add_vertex((300, 339)) right_arm.filled = True right_arm.fill_color = 'peru' right_arm.color = 'navy' window.add(right_arm) right_hand = GOval(7, 6) right_hand.filled = True right_hand.fill_color = 'royalblue' right_hand.color = 'navy' window.add(right_hand, 213, 234) # Face face = GPolygon() face.add_vertex((283, 345)) face.add_vertex((322, 350)) face.add_vertex((305, 307)) face.add_vertex((306, 290)) face.add_vertex((270, 277)) face.add_vertex((255, 278)) face.add_vertex((253, 288)) face.add_vertex((255, 298)) face.add_vertex((251, 309)) face.add_vertex((251, 311)) face.add_vertex((253, 311)) face.add_vertex((254, 316)) face.add_vertex((260, 319)) face.add_vertex((258, 323)) face.add_vertex((262, 329)) face.add_vertex((275, 326)) face.filled = True face.fill_color = 'peru' face.color = 'navy' window.add(face) ear1 = GOval(10, 15) ear1.filled = True ear1.fill_color = 'peru' ear1.color = 'navy' window.add(ear1, 278, 288) ear2 = GOval(6, 10) ear2.filled = True ear2.fill_color = 'peru' ear2.color = 'peru' window.add(ear2, 277, 293) jaw_line1 = GLine(x0=283, x1=285, y0=303, y1=312) jaw_line1.color = 'navy' window.add(jaw_line1) jaw_line2 = GLine(x0=285, x1=277, y0=311, y1=320) jaw_line2.color = 'navy' window.add(jaw_line2) eyebrow = GLine(x0=254, x1=259, y0=296, y1=293) eyebrow.color = 'navy' window.add(eyebrow) beard = GPolygon() beard.add_vertex((259, 323)) beard.add_vertex((260, 332)) beard.add_vertex((263, 334)) beard.add_vertex((270, 331)) beard.add_vertex((272, 319)) beard.add_vertex((262, 324)) beard.filled = True beard.fill_color = 'navy' beard.color = 'navy' window.add(beard) # Hair hair = GPolygon() hair.add_vertex((255, 278)) hair.add_vertex((270, 277)) hair.add_vertex((306, 290)) hair.add_vertex((308, 280)) hair.add_vertex((306, 270)) hair.add_vertex((300, 262)) hair.add_vertex((287, 256)) hair.add_vertex((270, 260)) hair.add_vertex((265, 263)) hair.add_vertex((256, 270)) hair.filled = True hair.fill_color = 'navy' hair.color = 'navy' window.add(hair) # Jersey jersey = GPolygon() jersey.add_vertex((252, 478)) jersey.add_vertex((331, 476)) jersey.add_vertex((334, 392)) jersey.add_vertex((325, 339)) jersey.add_vertex((303, 333)) jersey.add_vertex((272, 350)) jersey.add_vertex((277, 334)) jersey.add_vertex((261, 365)) jersey.add_vertex((251, 465)) jersey.filled = True jersey.fill_color = 'snow' jersey.color = 'navy' window.add(jersey) line1 = GPolygon() line1.add_vertex((286, 410)) line1.add_vertex((269, 423)) line1.add_vertex((277, 416)) line1.filled = True line1.fill_color = 'navy' line1.color = 'navy' window.add(line1) line2 = GPolygon() line2.add_vertex((278, 426)) line2.add_vertex((262, 439)) line2.add_vertex((268, 433)) line2.filled = True line2.fill_color = 'navy' line2.color = 'navy' window.add(line2) line3 = GPolygon() line3.add_vertex((270, 443)) line3.add_vertex((257, 457)) line3.add_vertex((262, 450)) line3.filled = True line3.fill_color = 'navy' line3.color = 'navy' window.add(line3) collar = GPolygon() collar.add_vertex((277, 334)) collar.add_vertex((272, 350)) collar.add_vertex((303, 333)) collar.add_vertex((325, 339)) collar.add_vertex((325, 335)) collar.add_vertex((305, 331)) collar.add_vertex((276, 343)) collar.filled = True collar.fill_color = 'navy' collar.color = 'navy' window.add(collar) stripe1 = GPolygon() stripe1.add_vertex((289, 400)) stripe1.add_vertex((289, 440)) stripe1.add_vertex((280, 477)) stripe1.add_vertex((288, 477)) stripe1.add_vertex((296, 440)) stripe1.add_vertex((296, 400)) stripe1.filled = True stripe1.fill_color = 'gold' stripe1.color = 'navy' window.add(stripe1) stripe2 = GPolygon() stripe2.add_vertex((302, 410)) stripe2.add_vertex((302, 440)) stripe2.add_vertex((296, 477)) stripe2.add_vertex((304, 477)) stripe2.add_vertex((309, 410)) stripe2.filled = True stripe2.fill_color = 'gold' stripe2.color = 'navy' window.add(stripe2) sleeveless1 = GOval(55, 65) sleeveless1.filled = True sleeveless1.fill_color = 'navy' sleeveless1.color = 'navy' window.add(sleeveless1, 276, 340) sleeveless2 = GPolygon() sleeveless2.add_vertex((261, 365)) sleeveless2.add_vertex((277, 334)) sleeveless2.add_vertex((261, 363)) sleeveless2.filled = True sleeveless2.fill_color = 'navy' sleeveless2.color = 'navy' window.add(sleeveless2) # Left Arm upper_arm = GOval(50, 58) upper_arm.filled = True upper_arm.fill_color = 'peru' upper_arm.color = 'navy' window.add(upper_arm, 279, 343) arm = GPolygon() arm.add_vertex((295, 380)) arm.add_vertex((301, 410)) arm.add_vertex((311, 440)) arm.add_vertex((315, 460)) arm.add_vertex((320, 478)) arm.add_vertex((330, 520)) arm.add_vertex((350, 518)) arm.add_vertex((345, 496)) arm.add_vertex((342, 476)) arm.add_vertex((340, 435)) arm.add_vertex((334, 405)) arm.add_vertex((328, 385)) arm.filled = True arm.fill_color = 'peru' arm.color = 'navy' window.add(arm) arm_line = GRect(31, 7) arm_line.filled = True arm_line.fill_color = 'peru' arm_line.color = 'peru' window.add(arm_line, 295, 380) wrist = GPolygon() wrist.add_vertex((329, 520)) wrist.add_vertex((351, 518)) wrist.add_vertex((351, 522)) wrist.add_vertex((330, 524)) wrist.filled = True wrist.fill_color = 'navy' wrist.color = 'navy' window.add(wrist) arm_pit = GPolygon() arm_pit.add_vertex((295, 385)) arm_pit.add_vertex((290, 380)) arm_pit.add_vertex((297, 394)) arm_pit.filled = True arm_pit.fill_color = 'navy' arm_pit.color = 'navy' window.add(arm_pit) # Left Hand left_hand = GPolygon() left_hand.add_vertex((330, 524)) left_hand.add_vertex((351, 522)) left_hand.add_vertex((358, 536)) left_hand.add_vertex((361, 554)) left_hand.add_vertex((359, 556)) left_hand.add_vertex((354, 537)) left_hand.add_vertex((358, 563)) left_hand.add_vertex((354, 565)) left_hand.add_vertex((348, 540)) left_hand.add_vertex((352, 567)) left_hand.add_vertex((347, 567)) left_hand.add_vertex((342, 540)) left_hand.add_vertex((345, 566)) left_hand.add_vertex((340, 565)) left_hand.add_vertex((335, 541)) left_hand.add_vertex((337, 560)) left_hand.add_vertex((332, 556)) left_hand.add_vertex((328, 536)) left_hand.filled = True left_hand.fill_color = 'peru' left_hand.color = 'navy' window.add(left_hand) # Basketball shadow shadow = GOval(70, 20) shadow.filled = True shadow.fill_color = 'gray' shadow.color = 'gray' window.add(shadow, 478, 683) # Basketball ball = GOval(80, 80) ball.filled = True ball.fill_color = 'darkorange' window.add(ball, 450, 620) line1 = GOval(80, 60) line1.filled = True line1.fill_color = 'darkorange' window.add(line1, 450, 630) line2 = GLine(x0=450, x1=530, y0=660, y1=660) window.add(line2) # Brand Name 'SPALDING' brand1 = GLabel('S') brand1.font = 'Impact-17' window.add(brand1, 461, 661) brand2 = GLabel('P') brand2.font = 'Impact-15' window.add(brand2, 470, 658) brand3 = GLabel('A') brand3.font = 'Impact-13' window.add(brand3, 478, 656) brand4 = GLabel('L') brand4.font = 'Impact-13' window.add(brand4, 486, 656) brand5 = GLabel('D') brand5.font = 'Impact-13' window.add(brand5, 492, 656) brand6 = GLabel('I') brand6.font = 'Impact-13' window.add(brand6, 500, 656) brand7 = GLabel('N') brand7.font = 'Impact-15' window.add(brand7, 504, 658) brand8 = GLabel('G') brand8.font = 'Impact-17' window.add(brand8, 512, 661) # Logo logo1 = GOval(10, 7) logo1.filled = True logo1.fill_color = 'darkorange' window.add(logo1, 485, 633) logo2 = GLabel('S') logo2.font = 'Courier-7-italic' window.add(logo2, 488, 641) # NBA Logo frame = GRect(10, 20) frame.filled = True frame.fill_color = 'black' window.add(frame, 485, 664) nba = GLabel('NBA') nba.color = 'white' nba.font = 'Times-3-bold' window.add(nba, 485, 685) head = GOval(2, 3) head.filled = True head.fill_color = 'darkorange' head.color = 'darkorange' window.add(head, 490, 664) body = GPolygon() body.add_vertex((490, 667)) body.add_vertex((484, 673)) body.add_vertex((493, 685)) body.filled = True body.fill_color = 'darkorange' body.color = 'darkorange' window.add(body) small_ball = GOval(3, 3) small_ball.filled = True small_ball.color = 'darkorange' small_ball.fill_color = 'darkorange' window.add(small_ball, 493, 674) arm = GLine(x0=490, x1=494, y0=667, y1=674) arm.color = 'darkorange' window.add(arm) # Words on the Basketball word1 = GLabel('GAME BALL SERIES') word1.font = '-2-bold' window.add(word1, 462, 672) word2 = GLabel('OUTDOOR') word2.font = '-1' window.add(word2, 470, 674) word3 = GLabel('Adam Silver') word3.font = 'Apple Chancery-4' window.add(word3, 498, 674) word4 = GLabel('COMMISSIONER') word4.font = '-1' window.add(word4, 504, 674)
def main(): """ User use campy module to draw their own picture. """ window = GWindow(800, 800, title='Find Everything about stanCode.app') frame_one = GRect(500, 450, x=150, y=175) frame_two = GRect(450, 500, x=175, y=150) corner_one = GOval(50, 50, x=150, y=150) corner_two = GOval(50, 50, x=150, y=600) corner_three = GOval(50, 50, x=600, y=150) corner_four = GOval(50, 50, x=600, y=600) outer = GOval(400, 400, x=200, y=200) middle_circle = GOval(250, 250, x=275, y=275) middle = GOval(240, 240, x=280, y=280) central_circle = GOval(70, 70, x=365, y=365) central = GOval(50, 50, x=375, y=375) left_radar_line = GLine(400, 400, 258.42, 258.58) right_radar_line = GLine(400, 400, 541.42, 258.58) stancode_point = GOval(20, 20, x=400, y=300) jerry_point = GOval(20, 20, x=335, y=515) stanford_point = GOval(20, 20, x=240, y=330) sc101_point = GOval(20, 20, x=500, y=500) sc001_point = GOval(20, 20, x=475, y=260) stancode_label = GLabel('stanCode', x=380, y=300) jerry_label = GLabel('Jerry', x=330, y=515) stanford_label = GLabel('Stanford', x=225, y=330) sc101_label = GLabel('SC101', x=490, y=500) sc001_label = GLabel('SC001', x=465, y=260) find_my_label = GLabel('Find My', x=300, y=720) window.add(frame_one) frame_one.color = 'gainsboro' frame_one.filled = True frame_one.fill_color = 'gainsboro' window.add(frame_two) frame_two.color = 'gainsboro' frame_two.filled = True frame_two.fill_color = 'gainsboro' window.add(corner_one) corner_one.color = 'gainsboro' corner_one.filled = True corner_one.fill_color = 'gainsboro' window.add(corner_two) corner_two.color = 'gainsboro' corner_two.filled = True corner_two.fill_color = 'gainsboro' window.add(corner_three) corner_three.color = 'gainsboro' corner_three.filled = True corner_three.fill_color = 'gainsboro' window.add(corner_four) corner_four.color = 'gainsboro' corner_four.filled = True corner_four.fill_color = 'gainsboro' window.add(outer) outer.color = 'springgreen' outer.filled = True outer.fill_color = 'springgreen' window.add(middle_circle) middle_circle.color = 'snow' middle_circle.filled = True middle_circle.fill_color = 'snow' window.add(middle) middle.color = 'mediumspringgreen' middle.filled = True middle.fill_color = 'mediumspringgreen' window.add(central_circle) central_circle.color = 'white' central_circle.filled = True central_circle.fill_color = 'white' window.add(central) central.color = 'royalblue' central.filled = True central.fill_color = 'royalblue' window.add(left_radar_line) left_radar_line.color = 'royalblue' window.add(right_radar_line) right_radar_line.color = 'royalblue' window.add(stancode_point) stancode_point.color = 'crimson' stancode_point.filled = True stancode_point.fill_color = 'crimson' window.add(jerry_point) jerry_point.color = 'crimson' jerry_point.filled = True jerry_point.fill_color = 'crimson' window.add(stanford_point) stanford_point.color = 'crimson' stanford_point.filled = True stanford_point.fill_color = 'crimson' window.add(sc101_point) sc101_point.color = 'crimson' sc101_point.filled = True sc101_point.fill_color = 'crimson' window.add(sc001_point) sc001_point.color = 'crimson' sc001_point.filled = True sc001_point.fill_color = 'crimson' window.add(stancode_label) window.add(jerry_label) window.add(stanford_label) window.add(sc101_label) window.add(sc001_label) window.add(find_my_label) find_my_label.font = '-60'
def main(): """ Create a window and lots of objects from GObject. Add those objects to the window to make the drawing. """ window = GWindow(width=600, height=470, title='little my') r = GRect(600, 470, x=0, y=0) r.filled = True r.color = '#1C3747' r.fill_color = '#1C3747' window.add(r) wood1 = GRect(25, 300, x=360, y=170) wood1.filled = True wood1.color = '#C29950' wood1.fill_color = '#C29950' window.add(wood1) wood3 = GRect(280, 190, x=230, y=10) wood3.filled = True wood3.color = '#8F4629' wood3.fill_color = '#8F4629' window.add(wood3) wood2 = GRect(240, 150, x=250, y=30) wood2.filled = True wood2.color = '#C29950' wood2.fill_color = '#C29950' window.add(wood2) grass = GOval(50, 140, x=-10, y=400) grass.filled = True grass.color = '#405F3E' grass.fill_color = '#405F3E' window.add(grass) grass = GOval(60, 140, x=10, y=420) grass.filled = True grass.color = '#5D7160' grass.fill_color = '#5D7160' window.add(grass) grass = GOval(90, 160, x=40, y=420) grass.filled = True grass.color = '#61806B' grass.fill_color = '#61806B' window.add(grass) grass = GOval(100, 140, x=80, y=430) grass.filled = True grass.color = '#435646' grass.fill_color = '#435646' window.add(grass) grass = GOval(180, 100, x=90, y=430) grass.filled = True grass.color = '#435646' grass.fill_color = '#435646' window.add(grass) grass = GOval(100, 150, x=200, y=410) grass.filled = True grass.color = '#405F3E' grass.fill_color = '#405F3E' window.add(grass) grass = GOval(110, 180, x=230, y=420) grass.filled = True grass.color = '#435646' grass.fill_color = '#435646' window.add(grass) l_shoe = GPolygon() l_shoe.add_vertex((170, 370)) l_shoe.add_vertex((190, 445)) l_shoe.add_vertex((190, 445)) l_shoe.add_vertex((200, 445)) l_shoe.add_vertex((210, 445)) l_shoe.add_vertex((220, 440)) l_shoe.add_vertex((230, 455)) l_shoe.add_vertex((220, 465)) l_shoe.add_vertex((200, 465)) l_shoe.add_vertex((185, 460)) l_shoe.add_vertex((180, 465)) l_shoe.add_vertex((168, 465)) l_shoe.add_vertex((155, 370)) l_shoe.filled = True l_shoe.fill_color = 'black' window.add(l_shoe) r_shoe = GPolygon() r_shoe.add_vertex((130, 370)) r_shoe.add_vertex((110, 445)) r_shoe.add_vertex((110, 445)) r_shoe.add_vertex((100, 445)) r_shoe.add_vertex((90, 445)) r_shoe.add_vertex((80, 440)) r_shoe.add_vertex((70, 455)) r_shoe.add_vertex((85, 465)) r_shoe.add_vertex((100, 465)) r_shoe.add_vertex((115, 460)) r_shoe.add_vertex((120, 465)) r_shoe.add_vertex((132, 465)) r_shoe.add_vertex((145, 370)) r_shoe.filled = True r_shoe.fill_color = 'black' window.add(r_shoe) dress = GPolygon() dress.add_vertex((108, 218)) dress.add_vertex((96, 250)) dress.add_vertex((45, 260)) dress.add_vertex((43, 275)) dress.add_vertex((71, 330)) dress.add_vertex((30, 390)) dress.add_vertex((90, 410)) dress.add_vertex((135, 415)) dress.add_vertex((166, 420)) dress.add_vertex((200, 415)) dress.add_vertex((270, 390)) dress.add_vertex((205, 265)) dress.add_vertex((355, 265)) dress.add_vertex((355, 250)) dress.add_vertex((205, 250)) dress.add_vertex((193, 218)) dress.filled = True dress.fill_color = '#B5272D' window.add(dress) l_hand = GPolygon() l_hand.add_vertex((90, 268)) l_hand.add_vertex((60, 275)) l_hand.add_vertex((80, 310)) l_hand.filled = True l_hand.fill_color = '#1C3747' window.add(l_hand) l_tie = GPolygon() l_tie.add_vertex((150, 238)) l_tie.add_vertex((105, 220)) l_tie.add_vertex((105, 255)) l_tie.filled = True l_tie.fill_color = '#D17989' window.add(l_tie) r_tie = GPolygon() r_tie.add_vertex((150, 238)) r_tie.add_vertex((195, 220)) r_tie.add_vertex((195, 255)) r_tie.filled = True r_tie.fill_color = '#D17989' window.add(r_tie) tie = GOval(20, 26, x=140, y=225) tie.filled = True tie.fill_color = '#D17989' window.add(tie) l_ear = GOval(40, 40, x=60, y=150) l_ear.filled = True l_ear.fill_color = '#FFF1E2' window.add(l_ear) r_ear = GOval(40, 40, x=200, y=150) r_ear.filled = True r_ear.fill_color = '#FFF1E2' window.add(r_ear) face = GOval(160, 140, x=70, y=90) face.filled = True face.fill_color = '#FFF1E2' window.add(face) l_eye = GArc(40, 90, -10, -180, x=90, y=140) l_eye.filled = True l_eye.fill_color = 'white' window.add(l_eye) l_eye_b = GArc(20, 60, -10, -178, x=100, y=148) l_eye_b.filled = True l_eye_b.fill_color = '#4A8165' window.add(l_eye_b) r_eye = GArc(40, 90, 10, -180, x=170, y=140) r_eye.filled = True r_eye.fill_color = 'white' window.add(r_eye) r_eye_b = GArc(20, 60, 10, -178, x=180, y=148) r_eye_b.filled = True r_eye_b.fill_color = '#4A8165' window.add(r_eye_b) nose1 = GLine(146, 160, 148, 173) nose1.color = 'black' window.add(nose1) nose2 = GLine(156, 160, 154, 173) nose2.color = 'black' window.add(nose2) nose3 = GLine(149, 175, 140, 199) nose3.color = 'black' window.add(nose3) nose4 = GLine(162, 199, 153, 175) nose4.color = 'black' window.add(nose4) nose5 = GLine(140, 199, 162, 199) nose5.color = 'black' window.add(nose5) mouth = GArc(100, 80, -30, -120, x=110, y=190) mouth.color = 'black' window.add(mouth) h_tail1 = GOval(50, 100, x=125, y=30) h_tail1.filled = True h_tail1.fill_color = '#F39401' h_tail1.color = '#F39401' window.add(h_tail1) h_tail1_line1 = GArc(160, 110, 120, 100, x=135, y=30) h_tail1_line1.color = 'black' window.add(h_tail1_line1) h_tail1_line2 = GArc(160, 110, 120, 100, x=142, y=30) h_tail1_line2.color = 'black' window.add(h_tail1_line2) h_tail1_line3 = GArc(160, 110, 60, -100, x=120, y=30) h_tail1_line3.color = 'black' window.add(h_tail1_line3) h_tail1_line4 = GArc(160, 110, 60, -100, x=127, y=30) h_tail1_line4.color = 'black' window.add(h_tail1_line4) h_tail1_line5 = GLine(150, 50, 150, 86) h_tail1_line5.color = 'black' window.add(h_tail1_line5) hair = GArc(160, 240, 0, 180, x=70, y=90) hair.filled = True hair.fill_color = '#F39401' hair.color = '#F39401' window.add(hair) hairline1 = GArc(800, 230, 115, 69, x=80, y=90) hairline1.color = 'black' window.add(hairline1) hairline2 = GArc(820, 230, 120, 66, x=95, y=89) hairline2.fill = 'black' window.add(hairline2) hairline3 = GArc(840, 240, 130, 58, x=110, y=88) hairline3.fill = 'black' window.add(hairline3) hairline4 = GArc(860, 240, 135, 56, x=125, y=87) hairline4.fill = 'black' window.add(hairline4) hairline5 = GArc(920, 250, 140, 53, x=135, y=85) hairline5.fill = 'black' window.add(hairline5) hairline6 = GLine(150, 110, 153, 150) hairline6.fill = 'black' window.add(hairline6) hairline7 = GArc(300, 400, 90, -75, x=80, y=96) hairline7.fill = 'black' window.add(hairline7) hairline8 = GArc(300, 425, 85, -70, x=75, y=93) hairline8.fill = 'black' window.add(hairline8) hairline9 = GArc(320, 475, 70, -55, x=90, y=90) hairline9.fill = 'black' window.add(hairline9) hairline10 = GArc(280, 500, 65, -50, x=100, y=90) hairline10.fill = 'black' window.add(hairline10) hairline11 = GArc(280, 530, 60, -45, x=100, y=90) hairline11.fill = 'black' window.add(hairline11) l_hand = GArc(50, 50, 40, -180, x=43, y=298) l_hand.filled = True l_hand.fill_color = 'black' window.add(l_hand) r_hand = GOval(40, 40, x=350, y=235) r_hand.filled = True r_hand.fill_color = 'black' window.add(r_hand) label = GLabel('Python!', x=263, y=140) label.font = 'Verdana-38-italic-bold' label.color = 'white' window.add(label) grass = GOval(120, 180, x=260, y=430) grass.filled = True grass.color = '#435646' grass.fill_color = '#5D7160' window.add(grass) grass = GOval(120, 180, x=330, y=450) grass.filled = True grass.color = '#405F3E' grass.fill_color = '#405F3E' window.add(grass) grass = GOval(120, 180, x=370, y=430) grass.filled = True grass.color = '#435646' grass.fill_color = '#435646' window.add(grass) grass = GOval(120, 150, x=430, y=420) grass.filled = True grass.color = '#4F5939' grass.fill_color = '#4F5939' window.add(grass) grass = GOval(80, 180, x=470, y=410) grass.filled = True grass.color = '#405F3E' grass.fill_color = '#405F3E' window.add(grass) grass = GOval(120, 150, x=500, y=440) grass.filled = True grass.color = '#435646' grass.fill_color = '#435646' window.add(grass) hatti = GRect(50, 170, x=420, y=300) hatti.filled = True hatti.color = '#DADADA' hatti.fill_color = '#DADADA' window.add(hatti) hatti_h = GOval(50, 50, x=420, y=275) hatti_h.filled = True hatti_h.color = '#DADADA' hatti_h.fill_color = '#DADADA' window.add(hatti_h) hatti_e = GOval(25, 25, x=420, y=300) hatti_e.filled = True hatti_e.color = 'black' hatti_e.fill_color = 'white' window.add(hatti_e) hatti_ee = GOval(25, 25, x=445, y=300) hatti_ee.filled = True hatti_ee.color = 'black' hatti_ee.fill_color = 'white' window.add(hatti_ee) hatti_b = GOval(10, 10, x=452.5, y=307.5) hatti_b.filled = True hatti_b.color = 'black' hatti_b.fill_color = 'black' window.add(hatti_b) hatti_bb = GOval(10, 10, x=427.5, y=307.5) hatti_bb.filled = True hatti_bb.color = 'black' hatti_bb.fill_color = 'black' window.add(hatti_bb) hatti = GRect(50, 210, x=480, y=260) hatti.filled = True hatti.color = '#DADADA' hatti.fill_color = '#DADADA' window.add(hatti) hatti_h = GOval(50, 50, x=480, y=235) hatti_h.filled = True hatti_h.color = '#DADADA' hatti_h.fill_color = '#DADADA' window.add(hatti_h) hatti_e = GOval(25, 25, x=480, y=260) hatti_e.filled = True hatti_e.color = 'black' hatti_e.fill_color = 'white' window.add(hatti_e) hatti_ee = GOval(25, 25, x=505, y=260) hatti_ee.filled = True hatti_ee.color = 'black' hatti_ee.fill_color = 'white' window.add(hatti_ee) hatti_b = GOval(10, 10, x=512.5, y=267.5) hatti_b.filled = True hatti_b.color = 'black' hatti_b.fill_color = 'black' window.add(hatti_b) hatti_bb = GOval(10, 10, x=487.5, y=267.5) hatti_bb.filled = True hatti_bb.color = 'black' hatti_bb.fill_color = 'black' window.add(hatti_bb) hatti = GRect(50, 150, x=520, y=320) hatti.filled = True hatti.fill_color = '#DADADA' window.add(hatti) hatti_h = GOval(50, 50, x=520, y=295) hatti_h.filled = True hatti_h.fill_color = '#DADADA' window.add(hatti_h) r = GRect(48, 25, x=521, y=321) r.filled = True r.color = '#DADADA' r.fill_color = '#DADADA' window.add(r) hatti_e = GOval(25, 25, x=520, y=320) hatti_e.filled = True hatti_e.color = 'black' hatti_e.fill_color = 'white' window.add(hatti_e) hatti_ee = GOval(25, 25, x=545, y=320) hatti_ee.filled = True hatti_ee.color = 'black' hatti_ee.fill_color = 'white' window.add(hatti_ee) hatti_b = GOval(10, 10, x=552.5, y=327.5) hatti_b.filled = True hatti_b.color = 'black' hatti_b.fill_color = 'black' window.add(hatti_b) hatti_bb = GOval(10, 10, x=527.5, y=327.5) hatti_bb.filled = True hatti_bb.color = 'black' hatti_bb.fill_color = 'black' window.add(hatti_bb) hatti = GRect(50, 150, x=450, y=380) hatti.filled = True hatti.fill_color = '#DADADA' window.add(hatti) hatti_h = GOval(50, 50, x=450, y=355) hatti_h.filled = True hatti_h.fill_color = '#DADADA' window.add(hatti_h) r = GRect(48, 25, x=451, y=380) r.filled = True r.color = '#DADADA' r.fill_color = '#DADADA' window.add(r) hatti_e = GOval(25, 25, x=450, y=380) hatti_e.filled = True hatti_e.color = 'black' hatti_e.fill_color = 'white' window.add(hatti_e) hatti_ee = GOval(25, 25, x=475, y=380) hatti_ee.filled = True hatti_ee.color = 'black' hatti_ee.fill_color = 'white' window.add(hatti_ee) hatti_b = GOval(10, 10, x=457.5, y=387.5) hatti_b.filled = True hatti_b.color = 'black' hatti_b.fill_color = 'black' window.add(hatti_b) hatti_bb = GOval(10, 10, x=482.5, y=387.5) hatti_bb.filled = True hatti_bb.color = 'black' hatti_bb.fill_color = 'black' window.add(hatti_bb)
def tube(): t_face = GOval(190, 160) window.add(t_face, x=380, y=150) t_face.color = 'ivory' t_face.fill_color = 'ivory' t_l_cheek = GOval(25, 15) window.add(t_l_cheek, x=400, y=232) t_l_cheek.color = 'lightpink' t_l_cheek.fill_color = 'lightpink' t_r_cheek = GOval(25, 15) window.add(t_r_cheek, x=510, y=232) t_r_cheek.color = 'lightpink' t_r_cheek.fill_color = 'lightpink' t_mouth1 = GRect(160, 20) window.add(t_mouth1, x=380, y=255) t_mouth1.color = 'gold' t_mouth1.fill_color = 'gold' t_mouth2 = GRect(150, 20) window.add(t_mouth2, x=390, y=275) t_mouth2.color = 'gold' t_mouth2.fill_color = 'gold' t_mouth3 = GOval(20, 20) window.add(t_mouth3, x=375, y=255) t_mouth3.color = 'gold' t_mouth3.fill_color = 'gold' t_mouth4 = GOval(20, 20) window.add(t_mouth4, x=380, y=275) t_mouth4.color = 'gold' t_mouth4.fill_color = 'gold' t_mouth5 = GOval(40, 40) window.add(t_mouth5, x=520, y=255) t_mouth5.color = 'gold' t_mouth5.fill_color = 'gold' t_mouth6 = GLine(385, 275, 535, 275) window.add(t_mouth6) t_mouth6.color = 'mustardyellow' t_nose1 = GOval(35, 32) window.add(t_nose1, x=450, y=240) t_nose1.color = 'gold' t_nose1.fill_color = 'gold' t_nose2 = GOval(4, 5) window.add(t_nose2, x=462, y=247) t_nose2.filled = True t_nose3 = GOval(4, 5) window.add(t_nose3, x=469, y=247) t_nose3.filled = True t_l_eye = GOval(10, 10) t_l_eye.filled = True window.add(t_l_eye, x=425, y=215) t_r_eye = GOval(10, 10) t_r_eye.filled = True window.add(t_r_eye, x=500, y=215) t_l_eye_2 = GArc(30, 12, 0, 200) t_l_eye_2.filled = True window.add(t_l_eye_2, x=415, y=195) t_r_eye_2 = GArc(30, 12, 0, 200) t_r_eye_2.filled = True window.add(t_r_eye_2, x=490, y=195) tube_name = GLabel('TUBE') tube_name.font = 'Verdana-30-bold' window.add(tube_name, x=430, y=380)
def main(): """ it shows the animation of a guinea pig with zentangle pattern, and a label will show on the top of window """ #background background = GRect(600, 600) background.filled = True window.add(background) #zentangle for i in range(0,600,30): line = GLine(i,0,600,600) window.add(line) line.color = 'white' pause(10) for j in range(0,600,30): line = GLine(600,j,0,600) window.add(line) line.color = 'wheat' pause(10) for k in range(0, 600, 30): line = GLine(600-k, 600, 0, 0) window.add(line) line.color = 'whitesmoke' pause(10) for l in range(0, 600, 30): line = GLine(0, 600-l, 600, 0) window.add(line) line.color = 'grey' pause(10) for m in range(0,300, 10): circle = GOval(m, m, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'red' pause(10) for n in range(0, 200, 40): circle = GOval(n, n, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'orange' pause(10) for o in range(100,300, 35): circle = GOval(o, o, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'yellow' pause(10) for p in range(50,200, 25): circle = GOval(p, p, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'lime' pause(10) for q in range(0,100, 15): circle = GOval(q, q, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'lightblue' pause(10) for r in range(300, 500, 30): circle = GOval(r, r, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'navy' pause(10) for s in range(0, 400, 50): circle = GOval(s, s, x=random.randrange(0, window.width), y=random.randrange(0, window.width)) window.add(circle) circle.color = 'purple' pause(10) #face face = GPolygon() face.add_vertex((255, 250)) face.add_vertex((345, 250)) face.add_vertex((355, 340)) face.add_vertex((245, 340)) forehead = GPolygon() forehead.add_vertex((270, 255)) forehead.add_vertex((330, 255)) forehead.add_vertex((335, 275)) forehead.add_vertex((265, 275)) l_chin = GPolygon() l_chin = GPolygon() l_chin.add_vertex((250, 310)) l_chin.add_vertex((300, 305)) l_chin.add_vertex((300, 340)) l_chin.add_vertex((247, 340)) r_chin = GPolygon() r_chin = GPolygon() r_chin.add_vertex((300, 305)) r_chin.add_vertex((350, 310)) r_chin.add_vertex((353, 340)) r_chin.add_vertex((300, 340)) nose = GOval(18, 35, x=292, y=290) l_eye = GOval(15, 17, x=280, y=285) r_eye = GOval(15, 17, x=310, y=285) l_foot = GOval(20, 30, x=233, y=315) r_foot = GOval(20, 30, x=348, y=315) l_ear = GOval(25, 15, x=230, y=265) r_ear = GOval(25, 15, x=345, y=265) mouse1 = GLine(300, 340, 300, 333) mouse2 = GLine(300, 333, 293, 323) mouse3 = GLine(300, 333, 307, 323) window.add(l_foot) l_foot.filled = True l_foot.fill_color = 'lightsalmon' l_foot.color = 'lightsalmon' window.add(r_foot) r_foot.filled = True r_foot.fill_color = 'lightsalmon' r_foot.color = 'lightsalmon' window.add(face) face.filled = True face.fill_color = 'goldenrod' face.color = 'goldenrod' window.add(forehead) forehead.filled = True forehead.fill_color = 'lightyellow' forehead.color = 'peachpuff' window.add(l_chin) l_chin.filled = True l_chin.fill_color = 'wheat' l_chin.color = 'wheat' window.add(r_chin) r_chin.filled = True r_chin.fill_color = 'wheat' r_chin.color = 'wheat' window.add(nose) nose.filled = True nose.fill_color = 'wheat' nose.color = 'wheat' window.add(mouse1) mouse1.color = 'brown' window.add(mouse2) mouse2.color = 'brown' window.add(mouse3) mouse3.color = 'brown' window.add(l_eye) l_eye.filled = True window.add(r_eye) r_eye.filled = True window.add(l_ear) l_ear.filled = True l_ear.fill_color = 'brown' l_ear.color = 'brown' window.add(r_ear) r_ear.filled = True r_ear.fill_color = 'brown' r_ear.color = 'brown' # words label = GLabel('Python is just like Zentangle - impossible to have the same works') label.font = 'Courier-10-italic' words_frame = GRect(530, 40, x=(window.width - label.width - 10) / 2, y=18) label.color = 'navy' window.add(words_frame) words_frame.filled = True words_frame.fill_color = 'lemonchiffon' words_frame.color = 'gold' window.add(label, x=(window.width - label.width) / 2, y=50) vx = 1 while True: label.move(vx, 0) words_frame.move(vx, 0) if words_frame.x <= 0 or words_frame.x + words_frame.width >= window.width: vx = -vx pause(DELAY)