|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转新大榭论坛!
您需要 登录 才可以下载或查看,没有账号?注册
x
题目:画椭圆。
/ w$ S/ B; M1 P程序分析:使用 tkinter。5 h4 t. ~. F* b/ k) d3 b5 K
- if __name__ == '__main__':& b8 v' L9 K4 T; x) N& g
- from tkinter import *- e {. P2 W. P' m; |' ~4 I
- x = 360
4 P# \6 ]* j1 D; Y' ? - y = 160
' @" d7 t% _* B. A+ A1 P4 r1 l - top = y - 30
' i3 a! f6 Q G0 @. L, P - bottom = y - 30 m+ V+ z# ~! ]: v
-
+ q# |! U2 t. \6 N* ^0 v - canvas = Canvas(width = 400,height = 600,bg = 'white')
; p3 S8 W$ V$ I3 P+ Z, R - for i in range(20):0 b/ ]; [. h; c9 P2 d' l
- canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)/ D+ H( z- I/ ~
- top -= 5
$ }- s$ O7 R S. R - bottom += 5& f4 o% P- L& Q7 B
- canvas.pack()
; E( O3 M6 {- F# P; r% X9 w - mainloop()
复制代码 |
|