Python Forum
python works on python 2 but not 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python works on python 2 but not 3
#1
hi, i am trying to open a blank window with tkinter. I am using this code for python 3
import tkinter
root = tkinter.Tk() 
print ("test")
root.mainloop()
I run it using python3 tkinter.py

this is the code for python2
import Tkinter
root = Tkinter.Tk()

print ("test")
root.mainloop()
I run it using python tkinter2.py

When i run tkinter.py it gives me the error
Error:
AttributeError: module 'tkinter' has no attribute 'Tk'
and when i run tkinter2.py it works fine.
Reply


Messages In This Thread
python works on python 2 but not 3 - by pythonbegginer - Jan-12-2020, 07:09 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020