本文整理汇总了Python中Tkinter.Tk.winfo_reqwidth方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.winfo_reqwidth方法的具体用法?Python Tk.winfo_reqwidth怎么用?Python Tk.winfo_reqwidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.winfo_reqwidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_ui
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_reqwidth [as 别名]
def _init_ui(self):
root = Tk()
root.title("pylens")
root.bind("<FocusOut>", self.close)
root.bind("<Escape>", self.close)
# center the window
root.withdraw()
root.update_idletasks() # Update "requested size" from geometry manager
x = (root.winfo_screenwidth() - root.winfo_reqwidth()) / 2
y = (root.winfo_screenheight() - root.winfo_reqheight()) / 2
root.geometry("+%d+%d" % (x, y))
root.deiconify()
text = Text(root)
text.config(width=60, height=1)
text.pack(side=LEFT, fill=Y)
text.bind("<Return>", self.handle_query)
text.focus_force()
return root, text
示例2: isinstance
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import winfo_reqwidth [as 别名]
if isinstance(index, tuple):
row, column = index
self.cell(row, column, value)
else:
raise Exception("Row and column indices are required")
def on_change_data(self, callback):
self._on_change_data = callback
if __name__ == "__main__":
try:
from Tkinter import Tk
except ImportError:
from tkinter import Tk
root = Tk()
table = Table(root, ["column A", "column B", "column C"], column_minwidths=[None, None, None])
table.pack(padx=10,pady=10)
table.set_data([[1,2,3],[4,5,6], [7,8,9], [10,11,12], [13,14,15],[15,16,18], [19,20,21]])
table.cell(0,0, " a fdas fasd fasdf asdf asdfasdf asdf asdfa sdfas asd sadf ")
table.insert_row([22,23,24])
table.insert_row([25,26,27])
root.update()
root.geometry("%sx%s"%(root.winfo_reqwidth(),250))
root.mainloop()