
1 import turtle as t 2 import tkinter 3 4 def DU(x,y): 5 t.pu() 6 t.goto(x,y) 7 t.pd() 8 t.done 9 10 def trangle(a,b,ft,color): 11 t.color("blue") 12 t.pensize(1) 13 t.pencolor(color) 14 t.forward(a) 15 t.right(90) 16 t.forward(b) 17 t.right(90) 18 t.forward(a) 19 t.right(90) 20 t.forward(b) 21 #字 22 t.right(90) 23 t.forward(a//2) 24 t.right(90) 25 t.forward(b) 26 27 t.write(ft,font=("Arial",20,"bold")) 28 t.done() 29 30 31 32 33 def Plan(): 34 #设置屏幕大小和颜色 35 #t.screensize(800,800,"green") 36 #设置窗口在屏幕的位置,小数为比例 37 t.setup(width=700,height=400,startx=None,starty=None) 38 t.title("Python模块") 39 40 t.pencolor("black") 41 t.pensize(3) 42 t.setposition(-350,0) 43 t.forward(700) 44 t.pu() 45 t.setposition(0,-200) 46 t.pd() 47 t.seth(90) 48 t.forward(400) 49 t.home() 50 #画矩形 51 DU(-320,170) 52 trangle(130,50,'a','blue') 53 54 55 t.done() 56 57 58 59 window = tkinter.Tk() 60 61 window.geometry("250x250+450+100") 62 63 window.title("计划书") 64 65 window.iconbitmap('a.ico') 66 67 #计划按钮 68 plan = tkinter.Button(window,text="计划行动轨迹",command=Plan) 69 70 plan.place(x=80,y=100,width=100,height=20) 71 72 ET = tkinter.Button(window,text="退出",command=window.quit) 73 74 ET.place(x=80,y=130,width=100,height=20) 75 76 window.mainloop() 77 78 79 80 81
支付宝扫一扫有惊喜哦!!!!