473,756 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[PMW] Rename a notebook's page - how?

Hi again,

I'd like to rename a page of a notebook. Deleting the page and adding a new
one is not really an option, because the page is filled with other controls
already. So I looked into Pmw.Notebook. There are quite a few lists and
dicts which were to be changed and I wasn't successful in the first try.

However, if nobody has ever done this, I'd have to rebuild the whole page
after deleting/adding. I really hope there's an other way to go.

Kind regards
Franz GEIGER



Jul 18 '05 #1
4 2478
On Tue, 2003-09-30 at 14:49, F. GEIGER wrote:
Hi again,

I'd like to rename a page of a notebook. Deleting the page and adding a new
one is not really an option, because the page is filled with other controls
already. So I looked into Pmw.Notebook. There are quite a few lists and
dicts which were to be changed and I wasn't successful in the first try.

However, if nobody has ever done this, I'd have to rebuild the whole page
after deleting/adding. I really hope there's an other way to go.

Kind regards
Franz GEIGER

You need to get hold of the "tab" widget and change it's text.

nb = Pmw.NoteBook(ro ot)
nb.pack()
nb.add("Page1")
nb.add("Page2")
nb.add("Page3")
tab = nb.tab("Page1")
tab["text"]= "Martin1"


Regards

--
Martin Franklin <mf********@gat wick.westerngec o.slb.com>
Jul 18 '05 #2
Thank you Martin,

but I've still troubles, because the tab has the new name now, but the page
is in PMW still known with the old name.

I see this because I've registered for the raisecommand event:

def _onSelect_(self , pageName):
Proxy.DataProxy ().containerSel ect(pageName)
return

And here pageName is the old name despite the fact that the new name is
displayed on the tab.

Kind regards
Franz GEIGER
"Martin Franklin" <mf********@gat wick.westerngec o.slb.com> schrieb im
Newsbeitrag news:ma******** *************** **********@pyth on.org...
On Tue, 2003-09-30 at 14:49, F. GEIGER wrote:
Hi again,

I'd like to rename a page of a notebook. Deleting the page and adding a new one is not really an option, because the page is filled with other controls already. So I looked into Pmw.Notebook. There are quite a few lists and
dicts which were to be changed and I wasn't successful in the first try.

However, if nobody has ever done this, I'd have to rebuild the whole page after deleting/adding. I really hope there's an other way to go.

Kind regards
Franz GEIGER

You need to get hold of the "tab" widget and change it's text.

nb = Pmw.NoteBook(ro ot)
nb.pack()
nb.add("Page1")
nb.add("Page2")
nb.add("Page3")
tab = nb.tab("Page1")
tab["text"]= "Martin1"


Regards

--
Martin Franklin <mf********@gat wick.westerngec o.slb.com>

Jul 18 '05 #3
On Tue, 2003-09-30 at 17:59, F. GEIGER wrote:
Thank you Martin,

but I've still troubles, because the tab has the new name now, but the page
is in PMW still known with the old name.

I see this because I've registered for the raisecommand event:

def _onSelect_(self , pageName):
Proxy.DataProxy ().containerSel ect(pageName)
return

And here pageName is the old name despite the fact that the new name is
displayed on the tab.

Kind regards
Franz GEIGER
"Martin Franklin" <mf********@gat wick.westerngec o.slb.com> schrieb im
Newsbeitrag news:ma******** *************** **********@pyth on.org...
On Tue, 2003-09-30 at 14:49, F. GEIGER wrote:
Hi again,

I'd like to rename a page of a notebook. Deleting the page and adding a new one is not really an option, because the page is filled with other controls already. So I looked into Pmw.Notebook. There are quite a few lists and
dicts which were to be changed and I wasn't successful in the first try.

However, if nobody has ever done this, I'd have to rebuild the whole page after deleting/adding. I really hope there's an other way to go.

Kind regards
Franz GEIGER

You need to get hold of the "tab" widget and change it's text.

nb = Pmw.NoteBook(ro ot)
nb.pack()
nb.add("Page1")
nb.add("Page2")
nb.add("Page3")
tab = nb.tab("Page1")
tab["text"]= "Martin1"

I've been trying to 'get round' this..... without much success
internally the NoteBook keeps track of it's pages using both a list of
names and a dictionary of name : page attributes

so I thought you could mess around with these...

notebook._pageA ttrs[newname] = notebook._pageA ttrs[oldname]
notebook.tab(ol dname)["text"]=newname
notebook._pageN ames[index]=newname
del notebook._pageA ttrs[oldname]

However when you try to raise your newly renamed page it fails :-(
because the callback that lifts the page to the top has the page name
stuck in it like so:

if self._withTabs:
# Create the button for the tab.
def raiseThisPage(s elf = self, pageName = pageName):
self.selectpage (pageName)
tabOptions['command'] = raiseThisPage
Where pageName is the name given at the time the page was created
(the above code is from the insert method in PmwNotebook)

So you would have to do quite a lot of messing around....
replacing the above callback with your own at least... This is where I
stopped trying...

So in order to keep it simple I would (in your own code) keep a
dictionary of old vs new page names or something simple like that.
So you above method would look something like this:-
def _onSelect_(self , pageName):
realPageName = self.myPageDict[pageName]
Proxy.DataProxy ().containerSel ect(realPageNam e)
return

Or failing that convert the pageName into a page index (an integer)
using the notebook.index( pageName) method.
HTH
Martin
P.S Most people on this list do not top post. (I'm not saying this is
good _or_ bad ;-)
--
Martin Franklin <mf********@gat wick.westerngec o.slb.com>
Jul 18 '05 #4

"Martin Franklin" <mf********@gat wick.westerngec o.slb.com> schrieb im
Newsbeitrag news:ma******** *************** ***********@pyt hon.org...
On Tue, 2003-09-30 at 17:59, F. GEIGER wrote:
Thank you Martin,

but I've still troubles, because the tab has the new name now, but the page is in PMW still known with the old name.

I see this because I've registered for the raisecommand event:

def _onSelect_(self , pageName):
Proxy.DataProxy ().containerSel ect(pageName)
return

And here pageName is the old name despite the fact that the new name is
displayed on the tab.

Kind regards
Franz GEIGER
"Martin Franklin" <mf********@gat wick.westerngec o.slb.com> schrieb im
Newsbeitrag news:ma******** *************** **********@pyth on.org...
On Tue, 2003-09-30 at 14:49, F. GEIGER wrote:
> Hi again,
>
> I'd like to rename a page of a notebook. Deleting the page and adding a
new
> one is not really an option, because the page is filled with other controls
> already. So I looked into Pmw.Notebook. There are quite a few lists

and > dicts which were to be changed and I wasn't successful in the first try. >
> However, if nobody has ever done this, I'd have to rebuild the whole

page
> after deleting/adding. I really hope there's an other way to go.
>
> Kind regards
> Franz GEIGER
>
>
>
You need to get hold of the "tab" widget and change it's text.

nb = Pmw.NoteBook(ro ot)
nb.pack()
nb.add("Page1")
nb.add("Page2")
nb.add("Page3")
tab = nb.tab("Page1")
tab["text"]= "Martin1"

I've been trying to 'get round' this..... without much success
internally the NoteBook keeps track of it's pages using both a list of
names and a dictionary of name : page attributes

so I thought you could mess around with these...

notebook._pageA ttrs[newname] = notebook._pageA ttrs[oldname]
notebook.tab(ol dname)["text"]=newname
notebook._pageN ames[index]=newname
del notebook._pageA ttrs[oldname]

However when you try to raise your newly renamed page it fails :-(
because the callback that lifts the page to the top has the page name
stuck in it like so:

if self._withTabs:
# Create the button for the tab.
def raiseThisPage(s elf = self, pageName = pageName):
self.selectpage (pageName)
tabOptions['command'] = raiseThisPage
Where pageName is the name given at the time the page was created
(the above code is from the insert method in PmwNotebook)

So you would have to do quite a lot of messing around....
replacing the above callback with your own at least... This is where I
stopped trying...


Many thanks for your effort, Martin!

So in order to keep it simple I would (in your own code) keep a
dictionary of old vs new page names or something simple like that.
So you above method would look something like this:-
def _onSelect_(self , pageName):
realPageName = self.myPageDict[pageName]
Proxy.DataProxy ().containerSel ect(realPageNam e)
return
That's a good idea! I'll go for that.



Or failing that convert the pageName into a page index (an integer)
using the notebook.index( pageName) method.
HTH
Martin
Many thanks again and kind regards
Franz GEIGER


P.S Most people on this list do not top post. (I'm not saying this is
good _or_ bad ;-)
--
Martin Franklin <mf********@gat wick.westerngec o.slb.com>

Jul 18 '05 #5

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

Similar topics

2
1547
by: F. GEIGER | last post by:
Hi all, I use PMW 1.2 on Python 2.3.0 on Win2k. I've created a dialog that looks like so: +----------------------+ Name | | +----------------------+ +----------------------+
1
1819
by: Greg | last post by:
I'm trying to create a megawidget for file selection that contains a Label, EntryField, and Browse Button (that will open a tkFileDialog). The label positioning won't cooperate however, could anyone help with this? Here's what I want: labelpos='w': ---------------------- ------------ Filename: |c:\directory\file | |Browse... | ---------------------- ------------
1
2112
by: stewart | last post by:
I'm writing an app that requires a 3-level optionMenu display. Basically I'm showing the contents of a 3-dimensional matrix. You choose the first level in the first optionMenu, the 2nd level in the next level, and the 3rd level in the last optionMenu. Let's call them Continent,country,state. continentList = countryList = ,,] stateList = ,,],] When I open the window, all is well. I can display the following as default
0
2588
by: David Vaughan | last post by:
py2exe and Pmw problem ---------------------- I was really surprised not to find some faq setting out what to do to get py2exe working for a program using Pmw. I'm haemorrhaging time here, and I'm now just after step-by-step guidance on using py2exe and Pmw together. I wasn't expecting this to take hours... I've used py2exe succesfully on non-gui programs, and the Python program
2
2524
by: Aki Niimura | last post by:
Hello everyone, I'm encountering a weird problem and couldn't find any Internet postings that are relevant to my problem and it seems coming from the Pmw Balloon widget inside. I have developed a Tkinter software using Pmw. The software is being developed under Solaris but is targeting all
0
2359
by: Stewart Midwinter | last post by:
I have a Tkinter app running on cygwin. It includes a Test menu item that does nothing more than fetch a directory listing and display it in a Toplevel window (I'd use a tkMessageBox showinfo widget, but for some reason the text is invisible on cygwin). After I close the Toplevel widget, all of the menus in my app behave as though they have no contents to them, i..e I can press on the File menu button, and see it depress, but the Exit...
1
3313
by: boriq | last post by:
Hello, could anybody be so kind and write me a small tutorial about "how to create a Pmw notebook with 3 tabs each containing 5 checkboxes" with the help of Rapyd-Tk? Thanks in advance rg, boris
3
1369
by: vajratkarviraj | last post by:
hey is it possible 2 package notebook with py2exe for distribution of my program 2 other ppl...? or packaging it wont even be necessary??? if so can sum1 send me a sample .py file on <removed> or send me an informative link....
2
1523
by: W. Watson | last post by:
I don't have Grayson's Tkinter book, but I see he uses something called Pmw. Why is it needed with Tkinter? -- Wayne Watson (Nevada City, CA) Web Page: <speckledwithStars.net>
0
9455
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
9271
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
10031
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...
0
9869
jinu1996
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...
0
8709
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
7242
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
5140
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...
1
3805
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
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.