I am creating lots of tabs, i.e. pages on an AGW.aui.auibook
I keep track of the panel windows by storing their object reference away
in a dict. i.e.
pages = {'<wx._windows.Panel; proxy of <Swig Object of type 'wxPanel *'
at 0x2da18e8> > : {'1' : 'np_page_contents_element', '2' :
'another_contents_page_element'}, ....}
The idea is to access items on that panel directly later, i.e. update a
TextValue, etc ...
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(str(key))
# 'fails' and always returns -1, not the real index of the notebook page
productPane = auibook.GetPage(p_index)
# of course then always refers to the last page of my notebook
But when that page is selected and I call:
auibook = self._mgr.GetPane("notebook_content").window
curr_page = auibook.GetCurrentPage
print curr_page
I get the expected
<wx._windows.Panel; proxy of <Swig Object of type 'wxPanel *' at
0x2da18e8> >
What am I missing?
I cannot sore away the index on page creation because pages can be
deleted, dragged, ....
So I need to have the window object reference somehow ....
I am creating lots of tabs, i.e. pages on an AGW.aui.auibook
I keep track of the panel windows by storing their object reference away
in a dict. i.e.
pages = {'<wx._windows.Panel; proxy of<Swig Object of type 'wxPanel *'
at 0x2da18e8> > : {'1' : 'np_page_contents_element', '2' :
'another_contents_page_element'}, ....}
The idea is to access items on that panel directly later, i.e. update a
TextValue, etc ...
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
Are you sure above returns you the auibook? In other words I think/guess the ".window" should not be there.
Test/check by doing a print auibook
p_index = auibook.GetPageIndex(str(key))
# 'fails' and always returns -1, not the real index of the notebook page
productPane = auibook.GetPage(p_index)
# of course then always refers to the last page of my notebook
that should work if auibook is the auibook:-) .
Just did a little test with aui.AuiNotebook in the WIT:
obj.p.b
<__main__.MyBook; proxy of <Swig Object of type 'wxPyPanel *' at 0x2b5bd38> >
for key, value in obj.myPages.iteritems():
obj.p.b.GetPageIndex(key)
3
1
2
0
MyBook = class MyBook(aui.AuiNotebook):.......
obj.myPages
{<wx._windows.Panel; proxy of <Swig Object of type 'wxPanel *' at 0x2de0088> >: 'n', <wx._windows.Panel; proxy of <Swig Object of type 'wxPanel *' at 0x2ddf448> >: 'n', <wx._windows.Panel; proxy of <Swig Object of type 'wxPanel *' at 0x2ddfd78> >: 'n', <wx._windows.Panel; proxy of <Swig Object of type 'wxPanel *' at 0x2ddd8b8> >: 'n'}
On Wed, Nov 9, 2011 at 11:31 AM, Tobias Weber <tobias.weber@roglink.net> wrote:
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(str(key))
The GetPageIndex method does not take a string as an argument, it
takes the window reference.
So how can I use my 'stored as a string' reference to the window then,
or is my dict useless?
What would be a way to have a collection of references to the pages,
i.e. windows?
Thanx
···
Am 09.11.11 20:18, schrieb Cody:
Hi,
On Wed, Nov 9, 2011 at 11:31 AM, Tobias Weber <tobias.weber@roglink.net> wrote:
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(str(key))
The GetPageIndex method does not take a string as an argument, it
takes the window reference.
--
--------------------------------------------------
Tobias Weber
CEO
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(str(key))
The GetPageIndex method does not take a string as an argument, it
takes the window reference.
So how can I use my 'stored as a string' reference to the window then,
or is my dict useless?
Seems like it, are you storing the repr of the window just so it can
be hashable as a dictionary key? If so I don't think there is any
reason to convert it to a string because window objects are hashable
already.
What would be a way to have a collection of references to the pages,
i.e. windows?
Just use the window reference without converting it to a string.
Regards,
Cody
···
On Wed, Nov 9, 2011 at 1:44 PM, Tobias Weber <tobias.weber@roglink.net> wrote:
Am 09.11.11 20:18, schrieb Cody:
On Wed, Nov 9, 2011 at 11:31 AM, Tobias Weber <tobias.weber@roglink.net> wrote:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(key)
???
Sorry fro asking instead of trying, I won't be back on my python-setup
computer before in around 2 hours
···
Am 09.11.11 20:57, schrieb Cody:
Hi,
On Wed, Nov 9, 2011 at 1:44 PM, Tobias Weber <tobias.weber@roglink.net> wrote:
Am 09.11.11 20:18, schrieb Cody:
Hi,
On Wed, Nov 9, 2011 at 11:31 AM, Tobias Weber <tobias.weber@roglink.net> wrote:
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(str(key))
The GetPageIndex method does not take a string as an argument, it
takes the window reference.
So how can I use my 'stored as a string' reference to the window then,
or is my dict useless?
Seems like it, are you storing the repr of the window just so it can
be hashable as a dictionary key? If so I don't think there is any
reason to convert it to a string because window objects are hashable
already.
What would be a way to have a collection of references to the pages,
i.e. windows?
Just use the window reference without converting it to a string.
it has to be- you can look it up in Andrea's code in the AGW AUI demo. I
was following along. Though complex especially the mgr is a very
powerful tool once
you get into it (still learning though ....)
···
Am 09.11.11 20:13, schrieb werner:
On 11/09/2011 06:31 PM, Tobias Weber wrote:
I am creating lots of tabs, i.e. pages on an AGW.aui.auibook
I keep track of the panel windows by storing their object reference away
in a dict. i.e.
pages = {'<wx._windows.Panel; proxy of<Swig Object of type 'wxPanel *'
at 0x2da18e8> > : {'1' : 'np_page_contents_element', '2' :
'another_contents_page_element'}, ....}
The idea is to access items on that panel directly later, i.e. update a
TextValue, etc ...
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
Are you sure above returns you the auibook? In other words I
think/guess the ".window" should not be there.
Thank you Cody- that did the trick. The strg conversion of the key in my
call was what screwd it up
auibook.GetPageIndex(key)
···
Am 09.11.11 21:10, schrieb Tobias Weber:
Am 09.11.11 20:57, schrieb Cody:
Hi,
On Wed, Nov 9, 2011 at 1:44 PM, Tobias Weber <tobias.weber@roglink.net> wrote:
Am 09.11.11 20:18, schrieb Cody:
Hi,
On Wed, Nov 9, 2011 at 11:31 AM, Tobias Weber <tobias.weber@roglink.net> wrote:
The problem is that I cannot access the pages/ panels properly
If I try for instance:
for key,value in pages.iteritems():
auibook = self._mgr.GetPane("notebook_content").window
p_index = auibook.GetPageIndex(str(key))
The GetPageIndex method does not take a string as an argument, it
takes the window reference.
So how can I use my 'stored as a string' reference to the window then,
or is my dict useless?
Seems like it, are you storing the repr of the window just so it can
be hashable as a dictionary key? If so I don't think there is any
reason to convert it to a string because window objects are hashable
already.
What would be a way to have a collection of references to the pages,
i.e. windows?
Just use the window reference without converting it to a string.