Tk GUI objects created by pydevconsole don't appear

Hi,

I've found that when I create Tk objects using the Pycharm python console, nothing appears on the screen. I initially thought this was connected with X11/Xorg, but I get the issue when the interpreter is running on Windows as well.

This is about as minimal a test as I can get:

>>> import tkinter
>>> tkinter.Tk()
<tkinter.Tk object .>
  • When I run this in a normal python console (ie. just typing "python" at the command line) a little window pops up.
  • If run from the Pycharm python console, nothing appears. I still get the message about the object being created, and there are no exceptions.

Is this by design, or is there a way I get this to work?

Thank you,

Sandy

0
2 comments

Hi, please try this example:

from tkinter import Tk
window = Tk()
window.title("Test")
window.mainloop()

Does it work?

0
Avatar
Permanently deleted user

That does work, which makes me even more confused. Normal Console: the window appears after the Tk() call. Pycharm Console - the window appears after the .mainloop() call.

Anyway, this was part of my debugging for a higher level issue, which I've now fixed. Thanks for your help.

0

Please sign in to leave a comment.