python - Tkinter Messagebox causing Entry to disable -


so creating simple input window tkinter whenever have showinfo displaying can't type in entry box

import tkinter tk tkinter import * tkinter.messagebox import *   root = tk.tk() root.title("hello world") root.minsize(700,600)  abc = stringvar() abc.set("abc") entry(root, bd = 1, width = 50, textvariable=abc).pack(side = top) showinfo('info', 'hello') root.mainloop()  

i'm not sure if there wrong python (3.4) or tkinter whenever take out showinfo line can type entry box when there can't.

tkinter messagebox default dialog boxes modal. means need close child window(the tkinter messagebox) before can return parent application.

so, there nothing wrong python or tkinter; behavior intended.

don't show tkinter messagebox before event loop started. try this:

import tkinter tk tkinter import * tkinter.messagebox import *    def callback():      showinfo("info", "hello")   root = tk.tk()  root.title("hello world")  root.minsize(700,600)   abc = stringvar()  abc.set("abc")  entry(root, bd=1, width=50, textvariable=abc).pack(side=top)  button(root, text="ok", command=callback).pack()  root.mainloop() 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -