本文整理汇总了Python中Tkconstants.BOTH属性的典型用法代码示例。如果您正苦于以下问题:Python Tkconstants.BOTH属性的具体用法?Python Tkconstants.BOTH怎么用?Python Tkconstants.BOTH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkconstants
的用法示例。
在下文中一共展示了Tkconstants.BOTH属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tkconstants [as 别名]
# 或者: from Tkconstants import BOTH [as 别名]
def __init__(self, master=None, **kw):
self.frame = Frame(master)
self.vbar = Scrollbar(self.frame)
self.vbar.pack(side=RIGHT, fill=Y)
kw.update({'yscrollcommand': self.vbar.set})
Text.__init__(self, self.frame, **kw)
self.pack(side=LEFT, fill=BOTH, expand=True)
self.vbar['command'] = self.yview
# Copy geometry methods of self.frame without overriding Text
# methods -- hack!
text_meths = vars(Text).keys()
methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
methods = set(methods).difference(text_meths)
for m in methods:
if m[0] != '_' and m != 'config' and m != 'configure':
setattr(self, m, getattr(self.frame, m))
示例2: example
# 需要导入模块: import Tkconstants [as 别名]
# 或者: from Tkconstants import BOTH [as 别名]
def example():
import __main__
from Tkconstants import END
stext = ScrolledText(bg='white', height=10)
stext.insert(END, __main__.__doc__)
stext.pack(fill=BOTH, side=LEFT, expand=True)
stext.focus_set()
stext.mainloop()
示例3: __init__
# 需要导入模块: import Tkconstants [as 别名]
# 或者: from Tkconstants import BOTH [as 别名]
def __init__(self, master, *scripts, **opts):
# build gui:
Tkinter.Frame.__init__(self, master, **opts)
master.title("Py-Span-Task")
self.scripts = list(scripts)
self.opts = {}
self.display_var = Tkinter.StringVar("")
width = master.winfo_screenwidth()
self.display = Tkinter.Message(self, justify=LEFT, textvar=self.display_var,
font=(fontname, fontsize),
width=width-(width/10), bg="white")
self.display.pack(fill=BOTH, expand=1)
self.entry_var = Tkinter.StringVar("")
self.entry = Tkinter.Entry(self, font=(fontname, fontsize),
state="disabled",
textvar=self.entry_var)
self.entry.pack(fill=X)
self.entry.bind('<Return>', lambda e:self.key_pressed('<Return>'))
self.bind('<space>', lambda e:self.key_pressed('<space>'))
# Sometimes lexical closures suck:
def event_handler_creator(frame, key):
return lambda e:frame.key_pressed(key)
for v in responses.values():
self.bind(v, event_handler_creator(self, v))
self.focus_set()
self.key_pressed(None)