473,516 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter button doesn't appear in OS X

I'm creating a shelve interface using Tkinter. I have a button that
allows the user to modify an existing entry; when the button is
clicked, a new TopLevel window appears with Entry boxes holding the
selected entry. Below the Entry boxes are two buttons, one that saves
the changes to the database and the other is simply a Cancel button.

Under Linux, both buttons appear correctly. However, in OS X the
Cancel button is invisible unless the window is resized or you click in
the area where the Cancel button is located. I believe it works
correctly under Windows (it's been a few days since I was able to check
it on a Windows machine).

Is there something special about OS X and Tkinter that I need to know
about or is it just a glitch I'll have to work around? Below is the
relevant code block:
------------------------------------------------------
def changeInven(self):
"""Allows modification of a database entry.

Called by modifyInven Button"""

try: #see if a selection was made
self.getSelection = self.listBox.curselection() #get index
of selection
self.selectedEntry = self.listBox.get(self.getSelection)
#get tuple from selection
(self.prodnum, self.descrip, self.colors, self.cost,
self.price,
self.quan) = self.selectedEntry #unpack tuple

#---New 'edit product' window
self.editWindow = Toplevel()
self.editWindow.title("Edit selected entry")

#---Edit product window widgets
Label(self.editWindow, text = "Product Number").grid(row =
0, column = 0)
Label(self.editWindow, text = "Description").grid(row = 0,
column = 1)
Label(self.editWindow, text = "Color").grid(row = 0, column
= 2)
Label(self.editWindow, text = "Unit cost").grid(row = 0,
column = 3)
Label(self.editWindow, text = "Sell price").grid(row = 0,
column = 4)
Label(self.editWindow, text = "Quantity").grid(row = 0,
column = 5)

self.oldNum = Entry(self.editWindow, name = "prodNum")
self.oldNum.grid(row = 1, column = 0)
self.oldDescrip = Entry(self.editWindow, name = "descrip")
self.oldDescrip.grid(row = 1, column = 1)
self.oldColor = Entry(self.editWindow, name = "color")
self.oldColor.grid(row = 1, column = 2)
self.oldCost = Entry(self.editWindow, name = "cost")
self.oldCost.grid(row = 1, column = 3)
self.oldPrice = Entry(self.editWindow, name = "price")
self.oldPrice.grid(row = 1, column = 4)
self.oldQuan = Entry(self.editWindow, name = "quan")
self.oldQuan.grid(row = 1, column = 5)

self.update = Button(self.editWindow, text = "Update
product",
command = self.updateProduct).grid(row = 2, column = 2)
self.cancel = Button(self.editWindow, text = "Cancel",
command = self.cancelProduct).grid(row = 2, column = 3)
#---Edit product data
self.oldNum.insert(END, self.prodnum)
self.oldDescrip.insert(END, self.descrip)
self.oldColor.insert(END, self.colors)
self.oldCost.insert(END, self.cost)
self.oldPrice.insert(END, self.price)
self.oldQuan.insert(END, self.quan)

except TclError: #tell user to make a selection first
showerror(title = "Error!", message = "You must make a
selection first!")

Dec 11 '06 #1
5 2024
crystalattice wrote:
I'm creating a shelve interface using Tkinter. I have a button that
allows the user to modify an existing entry; when the button is
clicked, a new TopLevel window appears with Entry boxes holding the
selected entry. Below the Entry boxes are two buttons, one that saves
the changes to the database and the other is simply a Cancel button.

Under Linux, both buttons appear correctly. However, in OS X the
Cancel button is invisible unless the window is resized or you click in
the area where the Cancel button is located. I believe it works
correctly under Windows (it's been a few days since I was able to check
it on a Windows machine).
What version of Tk are you running? I've seen this bug on old versions
of Tk (i.e. 8.4.7) but not recently.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Dec 11 '06 #2

Kevin Walzer wrote:
>
What version of Tk are you running? I've seen this bug on old versions
of Tk (i.e. 8.4.7) but not recently.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
I'm using Python 2.4.2, which I believe is the default version for OS
X. How do I check the Tk version? Can I force my programs to use a
different version of Python, e.g. if I installed Python 2.5?

Dec 12 '06 #3
crystalattice wrote:
Kevin Walzer wrote:
>What version of Tk are you running? I've seen this bug on old versions
of Tk (i.e. 8.4.7) but not recently.

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com

I'm using Python 2.4.2, which I believe is the default version for OS
X. How do I check the Tk version? Can I force my programs to use a
different version of Python, e.g. if I installed Python 2.5?
When you run your program on OS X, there should be a menu item next to
the Apple menu that says "about Tcl/Tk," which you access from the
"Python" menu item. That will give you the version number.

Python 2.3.5 and Tcl/Tk 8.4.7 ship with OS X 10.4. Python 2.4.2 is a
separate installation, but probably accesses the system Tcl/Tk unless
you have installed a more recent version. Using the official Mac build
of Python 2.5 will update your Python, but not Tcl/Tk--you'll need to
install something more recent.

You can install ActiveTcl for a "batteries-included" distro of
Tcl/Tk--it has the latest and greatest of everything. Or, you can
install a slightly older (8.4.13) version of Tcl/Tk at
http://tk-components.sourceforge.net. (This is a version of Tcl/Tk Aqua
that I use in my own programs and I made the build available for others
to use.)

Hope that helps,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Dec 12 '06 #4

Kevin Walzer wrote:
When you run your program on OS X, there should be a menu item next to
the Apple menu that says "about Tcl/Tk," which you access from the
"Python" menu item. That will give you the version number.

Python 2.3.5 and Tcl/Tk 8.4.7 ship with OS X 10.4. Python 2.4.2 is a
separate installation, but probably accesses the system Tcl/Tk unless
you have installed a more recent version. Using the official Mac build
of Python 2.5 will update your Python, but not Tcl/Tk--you'll need to
install something more recent.

You can install ActiveTcl for a "batteries-included" distro of
Tcl/Tk--it has the latest and greatest of everything. Or, you can
install a slightly older (8.4.13) version of Tcl/Tk at
http://tk-components.sourceforge.net. (This is a version of Tcl/Tk Aqua
that I use in my own programs and I made the build available for others
to use.)

Hope that helps,
Kevin

--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
Thanks for the info. It looks like it should work. I wasn't aware
that OS X is so "compartmentalized"; makes it a pain in the butt to
develop on sometimes.

Dec 12 '06 #5
I downloaded your file and got it working. Thanks for the hint and the
code. I really appreciate it.

Dec 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1560
by: Charles Starrett | last post by:
I am a just a dabbler in programming, but I'd like to make some simple cross-platform tools for generating webpages, as well as for text munging. One thing I need is a Mac OS 9/Windows GUI solution. I thought that Tkinter could provide this, but I'm having trouble getting the simple test script from Learning Python p.22 to work under Mac...
2
4694
by: Marc | last post by:
Hi all, I was using Tkinter.IntVar() to store values from a large list of parts that I pulled from a list. This is the code to initialize the instances: def initVariables(self): self.e = IntVar() for part, list in info.masterList.items():
1
6298
by: midtoad | last post by:
I'm trying to display a GIF image in a label as the central area to a Tkinter GUI. The image does not appear, though a space is made for it. Why is this so? I notice that I can display a GIF image in the central area of a simple menu-bar app as shown below in the first code sample. But, when I set up my app with a class, as shown below in...
7
4524
by: Harlin Seritt | last post by:
I was looking at the Tcl/Tk sourceforge page and found that there were a couple of new widgets being produced for Tcl 8.5. Does anyone know if there are any Tkinter wrappers somewhere? thanks, Harlin
0
2339
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo widget, but for some reason the text is invisible on cygwin). After I close the Toplevel widget, all of the menus in my app behave as though they...
1
5207
by: yvesd | last post by:
hello i want to intercept tkinter python system events like wm_delete_window and if possible for any window, but the newest code I've produced give me an error : Traceback (most recent call last): File "C:\Documents and Settings\yvesd\Bureau\protowin.py", line 36, in ? b1 = Tkinter.Button (win1)
0
1198
by: nish88 | last post by:
hi everybody...i'm trying to place an oval with a mouse click on my tkinter interface. can anyone please give me the code of how should i do it. i just want the part that i should add so that by clicking on interface an initial oval appear. thank you in advance.. here is my code. from Tkinter import * import Tkinter from Tkconstants...
3
3901
by: J-Burns | last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in programming itself... :P. Need some help here. Problem 1: How do I make something appear on 2 separate windows using Tkinter? By this I mean that the format would be something like this: You have Page1 : This has 2-3 buttons on it. Clicking on each button opens up a new...
0
1240
by: Guilherme Polo | last post by:
On Sat, Sep 20, 2008 at 4:10 PM, dmitrey <dmitrey15@ukr.netwrote: It is not only the button that doesn't respond, the entire application won't respond if you are blocking tcl from processing anything. This call to p.solve blocks, and, in turn the interpreter can't process events and the GUI remains frozen till p.solve returns. Ideally you...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.