473,473 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Tix, spinboxes, and 1>=5

This odd bug has been annoying me for several days now. I finally got
round to making this, frankly hilarious, testcase:
from Tix import *

def sayfive(num):
if num<5: print num,"< 5"
else: print num,">= 5"

sayfive(4)
sayfive(6)
rootwnd=Tk()
Control(rootwnd,command=sayfive).pack()
rootwnd.mainloop()
So, our program starts, the first two lines executed write "4<6" "6>=5"
as expected. Now the user changes the value in the spinner, and we get
output like "1>=5". What magic is Tix pulling, and more importantly how
the hell do I stop it?

Feb 23 '06 #1
2 1018
On Wed, 2006-02-22 at 18:37 -0800, cj*********@gmail.com wrote:
This odd bug has been annoying me for several days now. I finally got
round to making this, frankly hilarious, testcase:
from Tix import *

def sayfive(num):
if num<5: print num,"< 5"
else: print num,">= 5"

sayfive(4)
sayfive(6)
rootwnd=Tk()
Control(rootwnd,command=sayfive).pack()
rootwnd.mainloop()
So, our program starts, the first two lines executed write "4<6" "6>=5"
as expected. Now the user changes the value in the spinner, and we get
output like "1>=5". What magic is Tix pulling, and more importantly how
the hell do I stop it?


This should fix your problem:

from Tix import *

def sayfive(num):
num = int(num)
if num<5: print num,"< 5"
else: print num,">= 5"

sayfive(4)
sayfive(6)
rootwnd=Tk()
Control(rootwnd,command=sayfive).pack()
rootwnd.mainloop()
The entry in the spinbox is a string.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Feb 23 '06 #2
> The entry in the spinbox is a string.

Thanks. The only question now is why oh why would anyone design
something so stupid.
(severely tempted to go back to a strongly typed language before even
finishing one program)

Feb 23 '06 #3

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

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
34
by: Mark Moore | last post by:
It looks like there's a pretty serious CSS bug in IE6 (v6.0.2800.1106). The HTML below is validated STRICT HTML 4.01 and renders as I would expect in Opera, FrontPage, and Netscape. For some...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
1
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.