473,395 Members | 1,730 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,395 software developers and data experts.

Re: Tkinter/WindowsXP - how to use checkbutton to toggle a label inGUI?

En Thu, 21 Aug 2008 05:07:45 -0300, <du**********@gmail.comescribi�:
I've a checkbutton in my GUI application which I want to work as:

1. it should be un-ticked by default,
2. should display a label in Gui, by default,
3. when user ticks the check button this should the above label goes
off the screen and not longer is

Please suggest how could I do this:
Use the grid_forget method to hide the label. Based on your posted example:

from Tkinter import *

def onclick():
if varTestAll.get(): lblVersionUnderTest.grid_forget()
else: lblVersionUnderTest.grid(row=2, column=1)

master = Tk()
varTestAll = IntVar()
cbTestAll = Checkbutton(master, text="Test All", variable=varTestAll,
cbTestAll.grid(row=1, column=1)
lblVersionUnderTest = Label(master, text = "v2.1.5.0")
lblVersionUnderTest.grid(row=2, column=1)

But completely removing the label from the window looks strange. I'd
disable it; just replace the onclick function with this other one:

def onclick():
if varTestAll.get(): lblVersionUnderTest.config(state=DISABLED)
else: lblVersionUnderTest.config(state=NORMAL)

Gabriel Genellina

Aug 21 '08 #1
0 900

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

Similar topics

by: Rick Olson | last post by:
I'm trying to add a Tkinter interface to an existing C program with embedded python, but seem to have trouble importing Tkinter (or accessing it). I tried a simple program that would run the...
by: Ali | last post by:
I was wondering how one would go about displaying unicode in a Label object in a Tkinter window. I am trying to display text in another language. Please help.
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: Rich | last post by:
Could someone share how to toggle the font property of a label from regular to bold and back to regular? I have tried label.Font.Bold = True but get the error message that this property is...
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...
by: Kevin Walzer | last post by:
I'm trying to toggle the visibility of a Tkinter widget using pack_forget(), and I'm running into unexpected behavior. The widget "hides" correctly, but does not become visible again. My sample...
by: seanacais | last post by:
I'm trying to build an unknown number of repeating gui elements dynamically so I need to store the variables in a list of dictionaries. I understand that Scale "variable" name needs to be a...
by: dudeja.rajat | last post by:
Hi, I've a checkbutton in my GUI application which I want to work as: 1. it should be un-ticked by default, 2. should display a label in Gui, by default, 3. when user ticks the check button...
by: Mudcat | last post by:
I've tried quite a few things to get this correct but have hit a couple of sticking points that I can't figure out. I need to ge the Text box to function like the 'wraplength' option in a Label. ...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
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...
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...
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...
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,...

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.