|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转新大榭论坛!
您需要 登录 才可以下载或查看,没有账号?注册
x
题目:画椭圆。9 K8 X- n) Q, Q A5 ^2 z
程序分析:使用 tkinter。6 U' l/ p, o3 G" n1 z4 d- V
- if __name__ == '__main__':# s2 |$ @" Q8 I* _4 `0 Z* P1 J ~
- from tkinter import *
& x& P! ]8 H) J. k' f - x = 3606 Y" s `# U0 o3 x$ h) h* Q u
- y = 160
$ ], D( V# W% b' n9 M" A - top = y - 30- G* T4 B( | R( |# U4 w& O
- bottom = y - 30
2 q4 v9 U7 ?3 U1 U -
. y8 |3 ]) V: I, [: U8 q. C3 d: H - canvas = Canvas(width = 400,height = 600,bg = 'white')
% H/ X( s3 Z, }4 B# q$ ^. { - for i in range(20):6 B3 r" c/ }' B4 V6 Y4 G$ e
- canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)
- w( I6 C7 V7 c( J+ s" j4 S - top -= 5
* v- N% e6 ]+ v - bottom += 5
1 [+ q' J$ ~& J - canvas.pack()
( H' z7 V( j1 l# E% \ - mainloop()
复制代码 |
|