Sorry, I figured it out!
Error "ImportError: No module named tkinter" in Python Programming
Hi,
I am trying to write a Python program. This program is supposed to make a bar with two buttons on it pop up.
However, I cannot get this to work. The error is: "ImportError: No module named tkinter"
Below is the script of my program.
If anyone know enough about Python to know what I'm doing wrong, help would be greatly appreciated!
Thanks!
from tkinter import *
class Application(Frame):
def say_Yeh(self):
print("Yeh! Your button just did something!")
def createWidgets(self):
self.QUITBUTTON = Button(self)
self.QUITBUTTON["text"] = "QUIT BUTTON"
self.QUITBUTTON["fg"] = "red"
self.QUITBUTTON["command"] = self.quit
self.QUITBUTTON.pack({"side": "left"})
self.do_something = Button(self)
self.do_something["text"] = "CLICK TO DO SOMETHING BUTTON",
self.do_something["command"] = self.say_Yeh
self.do_something.pack({"side": "left"})
def _init_(self, master=None):
Frame._init_(self, master)
self.pack()
self.createWidgets()
root = Tk()
app = Application(master=root)
app.mainloop()
root.destroy()
Windows for home | Previous Windows versions | Apps
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
1 additional answer
Sort by: Most helpful
-
Anonymous
2011-06-16T10:23:17+00:00 i used google to get to this post hoping to find a solution to the problem! can you please tell us what the problem was? i installed activetlc hoping the error woule go away and it didnt.