本文整理汇总了Python中Theme.load方法的典型用法代码示例。如果您正苦于以下问题:Python Theme.load方法的具体用法?Python Theme.load怎么用?Python Theme.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Theme
的用法示例。
在下文中一共展示了Theme.load方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GUI
# 需要导入模块: import Theme [as 别名]
# 或者: from Theme import load [as 别名]
#.........这里部分代码省略.........
'row': 0,
'column': 0,
'width': None,
'height': None,
'rowspan': None,
'columnspan': None,
'padx': 0,
'pady': 0,
'sticky': 'NS',
'scrollable': False,
'rowweight': 1,
'columnweight': 1,
'menuindex': 1
}
self.widgets['main'] = { c.__name__ : c(parent=self.frames['right'], gui=self, **w) }
def setup(self):
'''
initializes the menubar and adds frames and widgets from the theme profile
'''
self.menubar = Tkinter.Menu(self, bg=self.colours['menubg'], fg=self.colours['menufg'], activeforeground=self.colours['menuactivefg'], activebackground=self.colours['menuactivebg'])
for f in self.theme.profile['frames']: # each frame in the profile
self.widgets[f['name']] = {} # make a slot for this frame
for w in f['widgets']: # each widget in the frame
c = self.getClass(w['name']) # get a reference to the class
self.widgets[f['name']][c.__name__] = c(parent=self.frames[f['name']], gui=self, **w) # initialize the class with attributes from the profile
self.config(menu=self.menubar)
if(len(self.specification.servos) > 0):
self.widgets['main']['TkMotionManager'].OnListMotionsClick() # if servos exist in this specification open the motion manager
else:
self.widgets['main']['TkServoManager'].OnListServosClick() # otherwise open the servo manager
def initTheme(self):
'''
loads the current theme
'''
self.theme = Theme(self.setting.get('gui_theme_name','DarkBlue'), self.screen)
self.theme.load()
self.images, self.colours, self.fonts = {}, {}, {}
for k, v in self.theme.images.iteritems():
self.images[k] = Tkinter.PhotoImage(file = os.path.join(self.theme.basepath, v))
self.colours = self.theme.colours
for k, v in self.theme.fonts.iteritems():
self.fonts[k] = tkFont.Font(family=v['family'], size=v['size'])
def initFrames(self):
'''
creates frames according to the profile
'''
self.frames = {}
if(self.theme.profile != None):
profile = self.theme.profile
self.frames['appWrap'] = Tkinter.Frame(self, bg=self.colours['bg'], borderwidth=0, highlightthickness=0)
self.frames['appWrap'].pack(fill=BOTH, expand=1)
self.frames['appWrap'].columnconfigure(0, weight=1)
self.frames['appWrap'].rowconfigure(0, weight=1)
self.frames['appCanvas'] = Tkinter.Canvas(self.frames['appWrap'], borderwidth=0, bg=self.colours['bg'], highlightthickness=0)
self.frames['appCanvas'].grid(column=0,row=0, padx= 10,sticky='WENS')
self.frames['app'] = Tkinter.Frame(self.frames['appCanvas'], bg=self.colours['bg'], borderwidth=0, highlightthickness=0)
self.frames['app'].pack(fill=BOTH, expand=1)
if(profile['scrollable']): #makes the whole window scrollable for accessibility
self.frames['appyScroller'] = Tkinter.Scrollbar(self.frames['appWrap'], orient=VERTICAL, command=self.frames['appCanvas'].yview, bg=self.colours['bg'], activebackground=self.colours['handle'], troughcolor=self.colours['trough'])
self.frames['appyScroller'].grid(column=1, row=0, sticky="NS")
self.frames['appxScroller'] = Tkinter.Scrollbar(self.frames['appWrap'], orient=HORIZONTAL, command=self.frames['appCanvas'].xview, bg=self.colours['bg'], activebackground=self.colours['handle'], troughcolor=self.colours['trough'])
self.frames['appxScroller'].grid(column=0, row=1, sticky="EW")
self.frames['appCanvas'].configure(yscrollcommand=self.frames['appyScroller'].set, xscrollcommand=self.frames['appxScroller'].set, bg=self.colours['bg'])
self.frames['appCanvas'].create_window((0,0),window=self.frames['app'], anchor=NW)
self.frames['app'].bind("<Configure>", self.scroll)