|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转新大榭论坛!
您需要 登录 才可以下载或查看,没有账号?注册
x
题目:画椭圆。2 H) e6 V, P$ l* p4 H9 X
程序分析:使用 tkinter。
4 r$ s5 Q8 Z m! ], ]- if __name__ == '__main__':
6 B. N1 l& e( ^# j: Q( W - from tkinter import *
8 q' U" l) O5 P3 Z: ]; [9 l - x = 360
! P Z* L5 |) |4 u E" ^1 d& r - y = 160
9 L" T1 [: L% f, u" b6 O - top = y - 30. n8 E) n M0 ~' s) a3 a
- bottom = y - 30
9 E7 Y( P& ~7 _) z3 ?2 n; N+ n h - & f4 _3 V! {. s
- canvas = Canvas(width = 400,height = 600,bg = 'white')* `% ]/ t# C `4 K+ v; q5 S
- for i in range(20):
* y+ F9 A! W0 e3 U G' C8 } - canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)
1 A0 t6 v3 y2 ~. ]$ V2 t - top -= 5. s& }8 ]" H8 w8 y1 L1 ]: C
- bottom += 5
) ^" I" v# _) i; x& w t" O: K, w - canvas.pack()
; r+ ^' R; x6 I1 H/ F - mainloop()
复制代码 |
|