My CheckButton variables seem always to be true, whether the box is checked or
not, which makes them considerably less useful. Following is a little script
that illustrates the difficulty. Any help will be greatly appreciated. Thank
you.
############### ############### #############
from Tkinter import *
def bCommand():
if c['variable']: ## ALSO TRIED: if cVbl
print 'bool(cVbl)==Tr ue'
else:
print 'bool(cVbl)==Fa lse'
root = Tk()
cVbl = IntVar()
c = Checkbutton(roo t,variable=cVbl )
c.pack(side=LEF T)
b = Button(root,hei ght=1,width=10, command=bComman d)
b.pack(side=LEF T)
root.mainloop() 1 3267
"Elaine Jackson" <el************ ***@home.com> wrote in message news:<OSMEc.954 254$oR5.38158@p d7tw3no>... My CheckButton variables seem always to be true, whether the box is checked or not, which makes them considerably less useful. Following is a little script that illustrates the difficulty. Any help will be greatly appreciated. Thank you.
############### ############### #############
from Tkinter import *
def bCommand(): if c['variable']: ## ALSO TRIED: if cVbl print 'bool(cVbl)==Tr ue' else: print 'bool(cVbl)==Fa lse'
root = Tk() cVbl = IntVar() c = Checkbutton(roo t,variable=cVbl ) c.pack(side=LEF T) b = Button(root,hei ght=1,width=10, command=bComman d) b.pack(side=LEF T) root.mainloop()
c[variable'] returns (of course) cVb1 and therefore will always be true.
You should use
if cVb1.get():
(etc.)
Michael This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: max(01)* |
last post by:
hello everybody.
i am a a bit of a newbie in python/tkinter,and i am experimenting a bit
with widgets like checkbuttons.
in python, you can create a checkbutton instance like this:
.....
self.tergicristalli = IntVar()
self.b1 = Checkbutton(self.pulsanti_spunta)
|
by: max(01)* |
last post by:
hi people.
when i create a widget, such as a toplevel window, and then i destroy
it, how can i test that it has been destroyed? the problem is that even
after it has been destroyed, the instance still exists and has a tkinter
name, so testing for None is not feasible:
>>> import Tkinter
>>> fin = None
>>> fin1 = Tkinter.Toplevel()
|
by: max(01)* |
last post by:
hello.
the following code:
1 from Tkinter import *
2
3 class MiaApp:
4 def __init__(self, genitore):
5 self.mioGenitore = genitore
6 self.i = IntVar()
|
by: Tuvas |
last post by:
I want to have a checkbutton that when it is pushed will do a function
depending on if it was pushed before or not. Ei:
b=checkbutton(command=check)
b.grid(row=0,column=0)
def check():
if (b.value==0):
do_stuff_here()
elif(b.value==1)
|
by: Michael Yanowitz |
last post by:
Hello:
Below I have included a stripped down version of the GUI I am working on.
It contains 2 dialog boxes - one main and one settings. It has the following
problems, probably all related, that I am hoping someone knows what I am
doing wrong:
1) Pressing the Settings.. Button multiple times, brings up many instances
of the Settings Panel. I just want it to bring up one. Is there an easy
way to do that?
| |
by: JyotiC |
last post by:
hi,
i am making a GUI using Tkinter,
I have a button and a checkbutton.
i want the button to be enable when checkbutton is on and disble when
the checkbutton is off.
thanx
|
by: Gigs_ |
last post by:
from Tkinter import *
states =
def onpress(i):
states = not states
root = Tk()
for i in range(10):
|
by: akineko |
last post by:
Hi everyone,
This is a memorandum so that other people can share the info.
The following methods are declared in the Tkinter Button class.
tkButtonDown(), tkButtonEnter(), tkButtonInvoke(), tkButtonLeave(),
tkButtonUp()
However, they are not working, when you try, you will get:
_tkinter.TclError: invalid command name "tkButtonLeave"
|
by: Francesco Bochicchio |
last post by:
Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto:
Uhm, I don't think you should use the grid manager to obtain a window
like that. The grid manager is for equally distributing widgets both
horizontally and vertically.
And I'm not sure that you can realize that window look with Tkinter.
You could get close by horizontally packing each widget row in a frame
and then vertically packing the frames in the window. But the look...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |