1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | from tkinter import * from tkinter.colorchooser import * window = Tk() window.title('ĵ¹ö½º¿¡ À̹ÌÁö¸¦ ³Ö°í ±× À§¿¡ ±×¸² ±×¸®±â') c = Canvas(window, width=700, height=500) c.pack() poem_text = ''' ³ªÅ ÁÖ ±×¸®¿î ³¯Àº ±×¸²À» ±×¸®°í ¾µ¾µÇÑ ³¯Àº À½¾ÇÀ» µé¾ú´Ù ±×¸®°íµµ ³²´Â ³¯Àº ³Ê¸¦ »ý°¢Çؾ߸¸ Çß´Ù ''' mycolor = 'yellow' def poem() : c.create_text(100, 100, anchor=NW, text="»ç´Â ¹ý", fill='yellow', font="±¼¸² 20 bold") c.create_text(100, 120, anchor=NW, text=poem_text, fill='yellow', font="±¼¸² 14 bold") def paint(event) : x1, y1 = event.x, event.y x2, y2 = event.x+3, event.y+3 c.create_oval(x1, y1, x2, y2, fill = mycolor, outline = mycolor) def change_color() : global mycolor color = askcolor() mycolor = color[1] def delete() : c.delete(ALL) c.create_image(0, 0, anchor=NW, image=img) poem() def quit() : window.destroy() img = PhotoImage(file="¹è°æ.png") c.create_image(0, 0, anchor=NW, image=img) c.bind("<B1-Motion>", paint) btn1 = Button(window, text='»ö»ó¼±ÅÃ', command=change_color) btn1.pack() btn2 = Button(window, text='Áö ¿ì ±â', command=delete) btn2.pack() btn3 = Button(window, text='Á¾·áÇϱâ', command=quit) btn3.pack() poem() window.mainloop() | cs |