Is there any way to delete a widget (window) from a Text widget, and
then add it back
to the Text, without re-creating the original widget. For example, I
think I would like to do
something like the following:
################################################## ########
from Tkinter import *
root = Tk()
textWidget = Text( root )
textWidget.pack()
#### create some widgets
widgets = [ Label( textWidget, text=" Hello World #%d! " % (i,) ) \
for i in range(3) ]
#### add all of them to Text
for widget in widgets:
posn = textWidget.index(INSERT)
textWidget.window_create( posn, window=widget )
#### delete the last one from Text
widget - widgets[-1]
textWidget.delete( posn ) # doesn't delete from children of Text
widget.destroy() # this doesn't seem to make any diff, but it does
delete from children
#### try to add it again
textWidget.window_create( posn, window=widget ) #### FAILS !!!
root.mainloop()
###############################################
That last window_create fails with:
_tkinter.TclError: bad window path name ".1076792812.1076865452"
I woule like to create a number of widget objects, then add / subtract
/ re-add them in
a predicatable order (stack-like)
I'm trying to implement 'Wizard-like' behaviour, but in a single Text
window, where
you step through in small chunks, adding new widgets, but are able to
step backwards
by deleteing them. I was hoping not to have to re-create the widgets
again when
moving forwards, as I was hoping for an easy way to maintain the state.
thanks
neal 2 2805
Sigh. Of course, near the middle is supposed to be:
#### delete the last one from Text
widget = widgets[-1]
I now see that I can accomplish what I want using the Canvas widget,
instead of the
Text widget (I.e., I can create a window on it, delete the window, then
re add it without
recreating the underlying widget object).
As I don't want the raw contents user-editable, I guess its better to
use a Canvas, rather
than a Text (slightly harder to use, though, I guess)
neal This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Thomas Buschhardt |
last post by:
Hallo,
I have a problem with Tkinter and the module socket. In a console-window
everything works fine, but in a Tkinter-window I can no more use the
widgets. I found some other mails with this...
|
by: Phil Schmidt |
last post by:
I'm trying to make a custom entry widget, as in the code that follows.
There are two problems I'm trying to fix:
1) I would like the widget to behave as myEntry.Escape() does now,
except that it...
|
by: rick.lawson |
last post by:
I, like a lot of developers, have collected a homegrown set of widgets for
Tkinter.
Any thoughts on a central repository for Tkinter widgets or widget
extensions? Stuff that's not in Tkinter or...
|
by: BJörn Lindqvist |
last post by:
See: http://www.wxpython.org/quotes.php. especially:
"wxPython is the best and most mature cross-platform GUI toolkit,
given a number of constraints. The only reason wxPython isn't the
standard...
|
by: Matt Hammond |
last post by:
Here's a strange one in Tkinter that has me stumped:
(I'm running python 2.4 on Suse Linux 9.3 64bit)
I'm trying to make a set of Entry widgets with Label widgets to the left
of each one, using...
|
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: python programming newb |
last post by:
Hi all, first post.
I'm new to python and tkinter. I'm trying to write a program that
opens the root window with a button that then opens a toplevel window
that then has it's own widgets. I...
|
by: vigacmoe |
last post by:
Hi all,
I'm trying to write a simple tkinter program, then this problem popped
up. The followin code will describe the problem.
------------------------------------------
import Tkinter
...
|
by: idsh |
last post by:
I cant make this code work. I am new at Python, and in this program I have made a simple mastermind program.
After creating the widgets, I try to insert text in the textbox in a function but all I...
|
by: MartinRinehart |
last post by:
Everything I've read about Tkinter says you create your window and
then call its mainloop() method. But that's not really true. This is
enough to launch a default window from the console:
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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:
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...
|
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,...
|
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...
|
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: 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...
| |