python - How to use tkinter to show information in the middle of a script -


i need understanding interaction between python script , tkinter. sure question have been answered can't find expect search terms wrong.

i have developed python script use daily prints information text , takes text input. there 1 place need display lot of information in tabular form , i'm trying use tkinter job. window / dialog appear show information , once ok button pressed disappear again.

all examples of using tkinter seem enter tkinter mainloop @ end of script think means data in , out through tkinter.

the best i've achieved far opens window data presented , button ends script completely.

exitbut = tkinter.button(framebuttons, text="exit", command=exitfn) exitbut.grid(row=0, column=0) describedialog.mainloop() 

can me understand how create , destroy temporary tkinter window in middle of python script please.

a simple example here, maybe not best practice shows can write script without using tkinter, show tkinter , carry on without it.

import tkinter tk  print("pretending here")  root=tk.tk() root.title("my window")  tk.label(root, text="show here").pack() tk.button(root, text="ok", command=root.destroy).pack()  root.mainloop()  print("now can else") print("note how execution of script stops @ call mainloop") print("but resumes afterwards") 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -