473,399 Members | 3,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

tkinter and textvariable option

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)
self.b1.configure(
text = "Tergicristalli a posto",
variable = self.tergicristalli ### (1)
)
self.b1.pack()
.....

where you bind the widget to a variable 'self.tergicristalli', which
will be updated as the user checks/unchecks the checkbutton.

maybe i interpret the question incorrectly, but the syntax (1) seems
like assigning the *value* of 'self.tergicristalli' to the variable
variable, while it is more like an aliasing instead...

my question is: how can i embed the above code inside a function body,
such that the function accepts as a parameter the variable to bind the
option 'variable' to (not the value, mind you!)? like this:

def acceptName(name):
....
self.tergicristalli = IntVar()
self.b1 = Checkbutton(self.pulsanti_spunta)
self.b1.configure(
text = "Tergicristalli a posto",
variable = name ### <<<--- THIS IS NOT WHAT I MEAN, OF COURSE!
)
self.b1.pack()
....

bye bye

macs
Jul 18 '05 #1
0 1335

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

Similar topics

2
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 =...
2
by: uri bushey | last post by:
Is there an easy way to have a label read from a variable, and update itself when the variable is changed? I have a dialogue that asks for a name, and a label that displays the name that is...
1
by: Club-B42 | last post by:
when i start opt_newlogin.py directly it works fine(outputs '1 1 1 1'), but if i start it from options.py there is an error(outputs ''). ======== opt_newlogin.py ======== from config import *...
5
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()
3
by: William Gill | last post by:
Working with tkinter, I have a createWidgets() method in a class. Within createWidgets() I create several StringVars() and assign them to the textvariable option of several widgets. Effectively my...
5
by: vagrantbrad | last post by:
I've created a short test program that uses tkFileDialog.askdirectory to help the user input a path into a tk entry widget. The problem I'm having is that when I run the code as listed below, the...
8
by: Lie | last post by:
Inspect the following code: --- start of code --- import Tkinter as Tk from Tkconstants import * root = Tk.Tk() e1 = Tk.Entry(root, text = 'Hello World') e2 = Tk.Entry(root, text = 'Hello...
0
by: Helmut Jarausch | last post by:
Hi, I'd like to bind the '<Return>' event to a function which does some calculations (like a database lookup) and then invoke tk_focusNext. I get an exception as many others have reported...
0
by: Kevin McKinley | last post by:
Below i've put the code for a program that i wrote. I need help on lines 384-403. If you run this program you will notice on the first tab when have it produce an answer the $ is surrounded with...
0
by: Guilherme Polo | last post by:
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <kem1723@yahoo.comwrote: Come on.. "help on lines 384-403", that is not a good way to look for help. You are supposed to post some minimal code that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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,...
0
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...

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.