码迷,mamicode.com
首页 > 编程语言 > 详细

用Python作GIS之四:Tkinter基本界面的搭建

时间:2015-02-23 16:40:07      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

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基本界面的搭建语法大致就是这样

用Python作GIS之四:Tkinter基本界面的搭建

标签:

原文地址:http://www.cnblogs.com/columbus2/p/4298083.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!