Why it doesn't works? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Why it doesn't works?

import tkinter as tk import tkinter as ttk win = tk.Tk() win.mainloop() 🤔

16th Mar 2019, 2:14 AM
Ayush Sinha
Ayush Sinha - avatar
2 Answers
+ 8
When you do import _ as __, what you're doing is storing all the functions in _ into the variable __. Therefore, you need to use win = tkk.Tk() or remove the 2nd line.
16th Mar 2019, 3:30 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
I think it is because you changed the module to be called ttk and it dosent reconize tk as a suitable shortcut for example if i say x = 1 and then say x = 2 then x changes from 1 to 2
16th Mar 2019, 2:29 AM
Zanir
Zanir - avatar