标签:
Python下的主窗口可以定义如下:
def start(self):
#self.project = Project("temp")
#self.project.directory = os.getcwd()
#Splash = SplashScreen(self.master)
self.hellos = 0
self.master.title("STARS: Space-Time Analysis of Regional Systems")
self.master.iconname("STARS")
self.master.bind("<Control-q>", self.quit)
h = self.winfo_screenheight()
w = self.winfo_screenwidth()
geom = "%dx%d"%(w,h)
self.master.geometry("600x400+0+0")
菜单定义如下:(仅列出File下的菜单,后略)
self.menuBar = [
(‘File‘, 0, # (pull-down)
[#(‘New Project ...‘, 0, self.newProject), # [menu items list]
(‘Open Project ...‘, 0, self.openProject),
(‘Project Summary‘,0,self.projectSummary),
‘separator‘, # add a separator
(‘Save Project ...‘, 0, self.saveProject),
(‘Save Project As ...‘,1, self.saveProjectAs),
‘separator‘,
(‘Exit <CTRL-q>‘, 1, self.Quit)] # label,underline,action
),
...
上面窗口退出的对应命令
def Quit(self):
# added to deal with shell+gui options
self.quit
self.master.destroy()
sys.exit(0)
STARS采用的Tkinter基本界面的搭建语法大致就是这样
标签:
原文地址:http://www.cnblogs.com/columbus2/p/4298083.html