Reputation: 19
I was running this code and it is supposed to be creating a window but it doesn't create any window in Pycharm. I am using Pycharm Community edition with Python 3.6. When I am running this code in IDLE, the window is generated.
import tkinter
from datetime import date, datetime
root = tkinter.Tk()
c = tkinter.Canvas(root,width =800, height =768, bg = 'black')
c.pack()
c.create_text(100,50, anchor = 'w', fill = 'orange', \
font = 'Arial 28 bold underline', text = 'My Countdown calendar')
Upvotes: 2
Views: 13254
Reputation: 3744
Regular python shell and IDLE supports using tk without a mainloop. This is done by several hooks, installed when a tkapp object is being initialized, which handles Tk events while the shell is waiting for user input. However pycharm does not support this. So inorder to diplay your window using pycharm, you have to call
root.mainloop()
at the end.
Upvotes: 11