|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转新大榭论坛!
您需要 登录 才可以下载或查看,没有账号?注册
x
题目:画椭圆。
$ V% g& P; C n0 d程序分析:使用 tkinter。
3 B& o; E+ J- P: c+ _- if __name__ == '__main__':
. I6 C% o$ J0 A - from tkinter import *9 ~ t. {8 N4 Y
- x = 360% S& N3 [% O- U* [
- y = 160
: j2 s3 j4 f( g" g - top = y - 30
! w% A. @" ]# \+ m1 ~/ O& f - bottom = y - 30
& z# _" Y; s U. |5 o' Q - L) V! g: a, p# l/ V4 U7 s0 S7 u
- canvas = Canvas(width = 400,height = 600,bg = 'white')1 |) X J' S* v* f f& u
- for i in range(20):
3 S" q6 I* ~5 K0 B! }; r8 c - canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)! \0 h/ a9 U, o" E' \2 v S
- top -= 5
, G7 q; e5 s% [, j" k - bottom += 5
" C: u9 M# i- q1 ^, c+ ~7 N2 l - canvas.pack(). E5 L! ^! l5 g) H; V3 G4 \
- mainloop()
复制代码 |
|