当前位置: 首页>>代码示例>>Python>>正文


Python Tk.wm_resizable方法代码示例

本文整理汇总了Python中tkinter.Tk.wm_resizable方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.wm_resizable方法的具体用法?Python Tk.wm_resizable怎么用?Python Tk.wm_resizable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.Tk的用法示例。


在下文中一共展示了Tk.wm_resizable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_window

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import wm_resizable [as 别名]
def create_window():

	"""Creates window object, sets title and resizing."""

	root = Tk()

	root.wm_title("Word Counter")
	root.wm_resizable(0, 0)

	return root
开发者ID:Ap0c,项目名称:WordCounter,代码行数:12,代码来源:counter.py

示例2: __init__

# 需要导入模块: from tkinter import Tk [as 别名]
# 或者: from tkinter.Tk import wm_resizable [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)
        
#.........这里部分代码省略.........
开发者ID:cakesmith,项目名称:Firefly,代码行数:103,代码来源:Jarvis.py


注:本文中的tkinter.Tk.wm_resizable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。