Python Tkinter IntVar Not Updating

后端 未结 1 1696
礼貌的吻别
礼貌的吻别 2021-01-24 22:08

I have two functions that are part of a Python 3.4.1 Tkinter GUI.

def jumpto():
    global jump
    jump = Tk()
    jump.wm_title(\"Jump\")
    jump.focus_force(         


        
相关标签:
1条回答
  • 2021-01-24 23:08

    The thing is that you're making two instances of Tk(), which leads to strange behavior. The jump window should be a Toplevel window, which is the window to use if you want another window next to your Tk() window.

    close needs to accept an argument because it is called by a bind which always passes an event object which contains all kinds of information about the event that triggered the close function (things like mouse position and the key that was used to trigger the event). So calling it event instead of self would actually be more correct. self is a variable used in classes which contains class attributes.

    0 讨论(0)
提交回复
热议问题