A followup on the message below. The source code has errors in it because I keyed it in rather than copying and pasting, as pointed out by Alan Gauld. Joe replied with corrected code and said it worked for him. I took his code and ran it on the Mac and had the same problem as before: everything but the background color worked. I then installed Python on a Windows PC and tried the same code: with the PC, the background color works. So the problem seems to be bug in Tkinter for the Mac. Thanks Alan and Joe for your help.


Message: 3
Date: Sun, 15 Jun 2008 14:07:58 -0700
From: Arden Hall <[EMAIL PROTECTED]>
Subject: [Tutor] Tkinter problem
To: tutor@python.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

I'm trying to learn to use Tkinter from "Thinking in Tkinter" and don't seem to be able to get the examples to work the way they are supposed to. I have the latest version of Python on a Macbook. Here's an example of the kind of problem I run into:

The source code is:

   from Tkinter import *

   root = Tk()

   myContainer1 = Frame(root)
   myContainer.pack()

   button1 = Button(myContainer1)
   button1["text"} = "Hello, World!"
   button1[background"] = "green"
   button1.pack

   root.mainloop()

I can execute this, but the button isn't green (or any other color I try) although it turns blue when I click the mouse on it. . Similarly, I've tried to write a bit of code to create a canvas object and put a rectangle in it, but I can't dimension the canvas, change its color, or get the rectangle to appear. Any advice or suggestion where to look for documentation would be greatly appreciated.

Thanks
Arden


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to