Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104086
| From | Christian Gollwitzer <auriocus@gmx.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Application console for Tkinter program? |
| Date | 2016-03-05 08:52 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <nbe31k$c9$1@dont-email.me> (permalink) |
Hi all, is there an easy way to add an application console to a Tkinter program? For instance, can you embed IDLE into a program such that when a button is pressed, it pops up a REPL window where the running program can be examined? Say, there is a simple program like: ==================== import Tkinter as tk def runshell(): from idlelib.PyShell import main main() root=tk.Tk() nvar=tk.StringVar(root) en=tk.Entry(textvariable=nvar) en.pack() btn=tk.Button(text="Shell", command=runshell) btn.pack() root.mainloop() ==================== I want the button to popup a shell window, and then nvar.get() should give me whatever is currently written in the entry. The code above does not work as intended, it pops up a shell, but: 1) I can't reach the variables from the main program, i.e. print(nvar) gives me a NameError 2) If you click the Shell button twice, it locks up the program, because main() obviously starts it's own mainloop Christian
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Application console for Tkinter program? Christian Gollwitzer <auriocus@gmx.de> - 2016-03-05 08:52 +0100
Re: Application console for Tkinter program? Terry Reedy <tjreedy@udel.edu> - 2016-03-05 05:15 -0500
Re: Application console for Tkinter program? Christian Gollwitzer <auriocus@gmx.de> - 2016-03-05 12:45 +0100
Re: Application console for Tkinter program? Terry Reedy <tjreedy@udel.edu> - 2016-03-05 16:16 -0500
Re: Application console for Tkinter program? Christian Gollwitzer <auriocus@gmx.de> - 2016-03-06 10:23 +0100
Re: Application console for Tkinter program? Terry Reedy <tjreedy@udel.edu> - 2016-03-06 07:12 -0500
csiph-web