|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转新大榭论坛!
您需要 登录 才可以下载或查看,没有账号?注册
x
题目:画椭圆。
) E$ m$ k, g6 e4 y9 _3 ~: d程序分析:使用 tkinter。
5 Y% z8 e) {" V2 X8 V: t0 @- if __name__ == '__main__':5 o7 M, u* N" K2 {9 b6 K% j' L
- from tkinter import *8 L3 T; S J# M0 i. r3 [, U) l$ |
- x = 360
4 u3 R1 b& H$ O6 s5 b - y = 160
# t+ l6 v5 ~4 f8 ~+ l - top = y - 30' A& `" b3 L! w. O. H
- bottom = y - 30" E7 ?3 B! S5 b; C/ X4 T; G" v+ o( v
-
) x8 \ s" v' f - canvas = Canvas(width = 400,height = 600,bg = 'white')& W$ c# A( Z' X- x
- for i in range(20):2 p1 A" l7 ~& Y* t6 X/ n1 \; F8 k2 s
- canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)
/ }' n7 Y: o3 V; L0 j% d6 W - top -= 5
+ \% j# \* V$ V6 x4 Q; e! q* k& [ - bottom += 5! _* c+ N* w0 x( K- I
- canvas.pack()4 k6 N: `; G9 Z) O2 p$ J; {) w
- mainloop()
复制代码 |
|