0

Why tkinter window doesn't opens in Pycharm though it works perfectly in IDLE

plzzz help me

30th May 2017, 5:27 AM
Devanshu Rawat
Devanshu Rawat - avatar
9 Respuestas
+ 1
import Tkinter ( In python 2) import tkinter ( In python 3.x) maruthi = tkinter.Tk() #produces loop # your widgets will go here, (your widget may be button, canvas,checkbutton, entry, label, listbox, menubutton, menu, messege, radio button, scale, scrollbar, text, tkmessegebox etc) maruthi.mainloop() #action for the main loop
31st May 2017, 8:37 AM
onekpsc
+ 5
Do you get an error of some kind or does it simply not show and ends the program?
30th May 2017, 6:20 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Code that runs on IDLE but not in pycharm means your code is correct but something wrong with pycharm, Check build and run configurations
30th May 2017, 6:28 AM
onekpsc
+ 1
james i shows nothing it just exits program
31st May 2017, 8:14 AM
Devanshu Rawat
Devanshu Rawat - avatar
+ 1
oh i just got the solution code is working by putting tk.mainloop() in end and bytheway tk =Tk()
31st May 2017, 8:16 AM
Devanshu Rawat
Devanshu Rawat - avatar
+ 1
Did you close the main loop at the very bottom?
31st May 2017, 8:16 AM
onekpsc
+ 1
yep
31st May 2017, 8:17 AM
Devanshu Rawat
Devanshu Rawat - avatar
+ 1
i am just doing this but can u explain me that what exactly it is doing
31st May 2017, 8:18 AM
Devanshu Rawat
Devanshu Rawat - avatar
+ 1
closing the main loop will take action against each event triggered by the user (window closes only when you click cancel button otherwise it is a infinite loop) if you don't close the loop it wont take any action
31st May 2017, 8:30 AM
onekpsc