kyle.tk at gmail.com
Tue Dec 6 03:01:52 CET 2005
> I am trying to learn Python and I have a few questions.
> I have created a Class that is essentially a canvas with a red
> background. After creation I want to change the background to green.
> However I am having problems doing this.
> Here is my code:
> from Tkinter import *
> class MyApp:
> def __init__(self, parent):
> self.myParent = parent
> self.myContainer = Frame(parent)
> self.b1 = Canvas(self.myContainer, background="red").grid(row=0,
> def ChangebgColor(self):
> root = Tk()
> myapp=MyApp(root) #Everything is fine at this point.
> ChangebgColor(myapp.b1) # Error Message at this point
> Any help will be greatly appreciated.
here ya go.
from Tkinter import *
def __init__(self, parent):
self.myParent = parent
self.myContainer = Frame(parent)
self.b1 = Canvas(self.myContainer, background="red")
root = Tk()
More information about the Python-list