本文整理汇总了Python中tkinter.Tk.wm_maxsize方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.wm_maxsize方法的具体用法?Python Tk.wm_maxsize怎么用?Python Tk.wm_maxsize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tkinter.Tk
的用法示例。
在下文中一共展示了Tk.wm_maxsize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import wm_maxsize [as 别名]
class IO:
def __init__(self, thread):
# set up screen, width = 512, height = 256
self.mythread = thread
self.screen = Tk()
self.screen.title("Jarvis Simulator")
self.screen.geometry("512x256+1600+500")
self.screen.wm_maxsize(width=512, height=256)
self.screen.wm_minsize(width=512, height=256)
self.screen.wm_resizable(width=False, height=False)
self.image = PhotoImage(width = 512, height = 256)
self.label = Label(self.screen, image=self.image)
self.label.grid()
# set up keyboard
for c in self.Keycodes.keys():
exec("self.screen.bind(\"<%s>\", self.%s)" % (c, c))
self.screen.bind("<Any-KeyPress>", self.KeyPressed)
self.screen.bind("<Any-KeyRelease>", self.KeyReleased)
system("xset r off")
self.screen.protocol("WM_DELETE_WINDOW", self.delete_callback)
def delete_callback(self):
system("xset r on")
self.mythread.stop()
self.screen.destroy()
KBD = 0
Keycodes = { "Return" : 128,
"BackSpace" : 129,
"Left" : 130,
"Up" : 131,
"Right" : 132,
"Down" : 133,
"Home" : 134,
"End" : 135,
"Prior" : 136,
"Next" : 137,
"Insert" : 138,
"Delete" : 139,
"Escape" : 140 }
for i in range(1,13):
k = { "F" + str(i) : 140+i }
Keycodes.update(k)
for key in Keycodes.keys():
code = Keycodes[key]
exec("""def %s(self, event):
self.KBD = %s
if debugKBD:
print(%s)""" % (key, code, code))
def KeyPressed(self, event):
if event.char:
self.KBD = ord(event.char)
if debugKBD:
print(str(ord(event.char)))
def KeyReleased(self, event):
self.KBD = 0
if debugKBD:
print("Key Released.\n")
def drawFill(self, color):
horizontal_line = "{" + " ".join([color]*self.image.width()) + "}"
self.image.put(" ".join([horizontal_line] * self.image.height()))
def drawPoint(self, x, y, color):
#~ print("Drawing %s point at (%i, %i)" % (color, x, y))
self.image.put(color, (x, y))
def drawmem(self, location, value):
(y, x) = divmod(location,32)
x = x * 16
memword = binary(value, bits=16)
#.........这里部分代码省略.........