Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 python works on python 2 but not 3
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")
I run it using python3

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

print ("test")
I run it using python

When i run it gives me the error
AttributeError: module 'tkinter' has no attribute 'Tk'
and when i run it works fine.
Larz60+ wrote Jan-12-2020, 11:23 PM:
fixed code tags, use '[python]', not '[code]'
add in line one if use python 3
or add
for python 2

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)