|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转新大榭论坛!
您需要 登录 才可以下载或查看,没有账号?注册
x
题目:画椭圆。' D8 U) q& d! v/ }' }
程序分析:使用 tkinter。' P o0 E/ _( R9 M0 F0 U
- if __name__ == '__main__':9 G5 O# i1 H; ]$ Z5 N
- from tkinter import *8 r1 v0 u- J4 {4 M/ s( u% T
- x = 360
& N9 y3 a& N! O' V! ` - y = 160
8 ]8 s8 w6 t6 f7 ^/ e - top = y - 30
! G9 u/ D! r3 }: l* n - bottom = y - 309 T: P5 F: P: {, O
- ; O$ Y& p& H) M# G' U, a, c
- canvas = Canvas(width = 400,height = 600,bg = 'white')
6 ^8 P& w) d, s4 h0 s% ?/ m/ N - for i in range(20):& D2 I0 y5 x# c
- canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)
) k% D+ @2 K V* _3 t- f6 P4 [ - top -= 5& ?! d7 M. G8 ~
- bottom += 5& M' \+ G, B- @ ]/ H7 e
- canvas.pack()
# B. D* I: R1 Y - mainloop()
复制代码 |
|