首先在ubuntu下安装Tkinter包
转载:http://blog.csdn.net/ajieyxw/article/details/46489845
sudo apt-get install python-tk
sudo apt-get install python-imaging-tk
sudo apt-get install python-pip
sudo pip install requests
程序为:
1 # -*- coding:utf-8 -*-
2 if __name__ == '__main__':
3 from Tkinter import *
4 x = 360
5 y = 160
6 top = y - 30
7 bottom = y - 30
8 canvas = Canvas(width = 400,height = 600,bg = 'white')
9 for i in range(20):
10 canvas.create_oval(250 - top,250 - bottom,250 + top,250 + bottom)
11 top -= 5
12 bottom += 5
13 canvas.pack()
14 mainloop()