本文整理汇总了Python中Tkinter.Tk.option_get方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.option_get方法的具体用法?Python Tk.option_get怎么用?Python Tk.option_get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.option_get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tk
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_get [as 别名]
class TkApplication:
# these are passed to Tk() and must be redefined by the subclasses:
tk_basename = ''
tk_class_name = ''
def __init__(self, screen_name=None, geometry=None):
self.init_tk(screen_name, geometry)
def init_tk(self, screen_name=None, geometry=None):
self.root = Tk(screenName=screen_name, baseName=self.tk_basename, className=self.tk_class_name)
app.root = self.root
from sk1.managers.uimanager import UIManager
app.uimanager = UIManager(self.root)
self.splash = SplashScreen(self.root)
self.splash.show()
self.splash.set_val(.1, 'DialogManager initialization...')
from sk1.managers.dialogmanager import DialogManager
app.dialogman = DialogManager(self.root)
self.splash.set_val(.15, 'Setting appication data...')
app.info1 = StringVar(self.root, '')
app.info2 = StringVar(self.root, '')
app.info3 = DoubleVar(self.root, 0)
# Reset locale again to make sure we get properly translated
# messages if desired by the user. For some reason it may
# have been reset by Tcl/Tk.
# if this fails it will already have failed in
# app/__init__.py which also prints a warning.
try:
import locale
except ImportError:
pass
else:
try:
locale.setlocale(locale.LC_MESSAGES, "")
except:
pass
if not geometry:
# try to read geometry from resource database
geometry = self.root.option_get('geometry', 'Geometry')
if geometry:
try:
self.root.geometry(geometry)
except TclError:
sys.stderr.write('%s: invalid geometry specification %s' % (self.tk_basename, geometry))
def Mainloop(self):
self.splash.set_val(1)
self.root.update()
self.root.deiconify()
self.root.after(300, self.splash.hide)
self.root.mainloop()
def MessageBox(self, *args, **kw):
return apply(tkext.MessageDialog, (self.root,) + args, kw)
def GetOpenFilename(self, **kwargs):
return apply(tkext.GetOpenFilename, (self.root,), kwargs)
def GetSaveFilename(self, **kwargs):
return apply(tkext.GetSaveFilename, (self.root,), kwargs)
clipboard = None
def EmptyClipboard(self):
self.SetClipboard(None)
def SetClipboard(self, data):
self.clipboard = data
def GetClipboard(self):
return self.clipboard
def ClipboardContainsData(self):
return self.clipboard is not None
示例2: Tk
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import option_get [as 别名]
class TkApplication:
# these are passed to Tk() and must be redefined by the subclasses:
tk_basename = ''
tk_class_name = ''
def __init__(self, screen_name = None, geometry = None):
self.init_tk(screen_name, geometry)
def init_tk(self, screen_name = None, geometry = None):
self.root = Tk(screenName = screen_name,
baseName = self.tk_basename,
className = self.tk_class_name)
# Reset locale again to make sure we get properly translated
# messages if desired by the user. For some reason it may
# have been reset by Tcl/Tk.
# if this fails it will already have failed in
# Sketch/__init__.py which also prints a warning.
try:
import locale
except ImportError:
pass
else:
try:
locale.setlocale(locale.LC_MESSAGES, "")
except:
pass
if not geometry:
# try to read geometry from resource database
geometry = self.root.option_get('geometry', 'Geometry')
if geometry:
try:
self.root.geometry(geometry)
except TclError:
sys.stderr.write('%s: invalid geometry specification %s'
% (self.tk_basename, geometry))
def Mainloop(self):
self.root.mainloop()
def MessageBox(self, *args, **kw):
return apply(tkext.MessageDialog, (self.root,) + args, kw)
def GetOpenFilename(self, **kwargs):
return apply(tkext.GetOpenFilename, (self.root,), kwargs)
def GetSaveFilename(self, **kwargs):
return apply(tkext.GetSaveFilename, (self.root,), kwargs)
clipboard = None
def EmptyClipboard(self):
self.SetClipboard(None)
def SetClipboard(self, data):
self.clipboard = data
def GetClipboard(self):
return self.clipboard
def ClipboardContainsData(self):
return self.clipboard is not None