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

Home Posts Topics Members FAQ

tkinter, overwrite Label-text?

using python And tkinter.

i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.

what is the best way to achieve that?

also, how do i make Label-text expand to the right and not to the left?
Apr 10 '08 #1
4 4561
On Apr 10, 2:35 pm, skanem...@yahoo .se wrote:
using python And tkinter.

i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.

what is the best way to achieve that?
[...]
Which widget do you use?

Some widgets can be connected to variables so that when the variable
changes the widget is automatically update.
Have a look <at http://docs.python.org/lib/node696.html>.

HTH,
Dennis Benzinger
Apr 10 '08 #2
On 10 Apr, 15:28, "Dennis.Benzin. ..@gmx.net"
<dennis.benzin. ..@gmx.netwrote :
On Apr 10, 2:35 pm, skanem...@yahoo .se wrote:
using python And tkinter.
i have a GUI that outputs a text among other things. after input form
user i want this text to be *)cleared and/or
*)overwritten.
what is the best way to achieve that?
[...]

Which widget do you use?

Some widgets can be connected to variables so that when the variable
changes the widget is automatically update.
Have a look <athttp://docs.python.org/lib/node696.html>.

HTH,
Dennis Benzinger
i use the Label-widget.
Apr 10 '08 #3
On Apr 10, 4:37 pm, skanem...@yahoo .se wrote:
[...]
i know how to do this already. the problem is i want the text to stay
in the windowa nd not start overwriting "Answer:".
i have solved this by using an Entry for the answer as well but id
prefer using a Label.
[...]
You can set the width option of the Label. For example:

b = Label(mygui, text=eval(expr) , width=20)

Then the Label will always be 20 characters wide no matter how long
the answer is.
You can read more about the options for Tk widgets in <http://
www.tcl.tk/man/tcl8.5/TkCmd/contents.htm>.

Dennis Benzinger
Apr 10 '08 #4
On Thu, 10 Apr 2008 07:37:08 -0700, skanemupp wrote:
i know how to do this already. the problem is i want the text to stay
in the windowa nd not start overwriting "Answer:".
Then don't use `place()` but let Tkinter handle the layout with the pack
and/or grid layout manager. GUIs with `place()` are a bad idea because
the GUI may look odd or is even unusable on other peoples computers with
other screen resolutions, fonts, and font sizes.

Ciao,
Marc 'BlackJack' Rintsch
Apr 10 '08 #5

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

Similar topics

3
4068
by: Rob Andrews | last post by:
I'm on a Red Hat 9 system, which has Python 2.2.2 installed, and I installed 2.3 separately into /home/rob/Python-2.3/ (creating the symbolic link "py23" to point to my 2.3 installation). Now I'm trying to work out the kinks in the process. Unable to run Idle using 2.3 the way I've got things set up, I created a super simple Tkinter test program that just pops up a Label widget. I pasted below an example of how the RH-provided 2.2 runs...
1
11705
by: Patrick L. Nolan | last post by:
We have a Tkinter application which has a menubar with cascade submenus. I would like to start the program with one of the submenu items state=DISABLED, then change it to state=NORMAL at a later time. I hope I just missed something obvious, because I can't figure out how to change its state. The problem comes about because the menu bar is built by several add_cascade() calls. Each of the cascades, in turn, has several add_command()...
1
6791
by: Philippe C. Martin | last post by:
Hi, I have he following need and do not find an easy way out: I have many menu items and would like them all to call the same method -However, I need the method called to react differently depending on the menu item selected. Since the menu command functions do not seem to receive any type of event style object, is there some type of Tkinter call that would let my method know the menu id selected ?
4
6369
by: Tim Jarman | last post by:
Apologies in advance for the long post - I wanted to be sure I included all the relevant details. The answer is probably very, very simple. I am doing something stupid here, but I don't know what it is. I'm writing an application with a Tkinter GUI (Python 2.4, Tcl/Tk 8.4.) and I want to put a custom icon on the main window. I've followed (so far as I understand it) the recipe in the eff-bot's splendid Introduction to Tkinter - see:...
6
4500
by: Bob Greschke | last post by:
Root.option_add("*?????*font", "Helvetica 12 bold") Want to get rid of the "font =": Widget.add_cascade(label = "File", menu = Fi, font = "Helvetica 12 bold") Does anyone know what ????? should be to control the font of the cascade menus (the labels on the menu bar)? "*Menu*font" handles the part that drops down, but I can't come up with the menu bar labels part. Thanks!
2
2844
by: ishtar2020 | last post by:
Hi everybody I'd appreciate some help on creating a tear off menu with TkInter. I've been reading some documentation but still no luck. Please don't get confused: when I mean "tear off" menu I don't mean a drop-down or a pop-up menu, but those options which yield to another batch of sub-options when scrolled over, (as for example, the File->New option from internet explorer).
2
2242
by: Dustan | last post by:
I don't know if this is because of Tkinter (ie Tk) itself or the Windows default way of handling things, but when I create a very long menu (my test is shown below), the way it displays is rather sucky; the menu stretches from the top of the moniter's window to the bottom (no matter the size of the actual application). Is there any alternative format for how a long menu gets displayed? It would be nice if say, I could make the menu only...
4
1965
by: Edward K. Ream | last post by:
Hello all, Creating a 'Help' menu 'by hand' on the Mac does not work, or rather, it creates a *second* Help menu. There are hints about how to do this at:
3
4210
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 StringVar but I cannot figure out how to initialize the dictionary. I've tried the following code ps = PowerSupply() # Instantiate a Power Supply VM Object numOPs = ps.getOnum() # Find the number of outputs OPValues = # Global list to...
0
1315
by: dudeja.rajat | last post by:
On Mon, Aug 25, 2008 at 12:57 PM, <dudeja.rajat@gmail.comwrote: Ok...now I found the way to do that. But I'm stuck further. my code is as below: main module ********************** myRoot = Tix.Tk() myAppGUIObject = myAppGUI(myRoot)
0
9669
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, 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...
0
9515
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,...
0
10426
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10154
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,...
0
9029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5430
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2913
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.