auinotebook tab area buttons

hi all, how can I bind event handlers to tab are buttons in the
agw.auinotebook?

thanks in advance for hints,

Marco

Hi,

hi all, how can I bind event handlers to tab are buttons in the

agw.auinotebook?

The source code is your friend:

EVT_AUINOTEBOOK_BG_MIDDLE_DOWN = wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_MIDDLE_DOWN, 1)

“”" The user middle-clicked in the tab area but not over a tab or a button. “”"

EVT_AUINOTEBOOK_BG_MIDDLE_UP = wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_MIDDLE_UP, 1)

“”" The user middle-clicked in the tab area but not over a tab or a button. “”"

EVT_AUINOTEBOOK_BG_RIGHT_DOWN = wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_RIGHT_DOWN, 1)

“”" The user right-clicked in the tab area but not over a tab or a button. “”"

EVT_AUINOTEBOOK_BG_RIGHT_UP = wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_RIGHT_UP, 1)

“”" The user right-clicked in the tab area but not over a tab or a button. “”"

EVT_AUINOTEBOOK_BG_DCLICK = wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 1)

“”" The user left-clicked on the tab area not occupied by AuiNotebook tabs. “”"

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/

···

On 11 August 2011 17:04, Marco Prosperi wrote:

thank you for the prompt answer but I haven't found the solution yet.
I don't want to bind an event handler to clicks on the background of
auitabctrl but to the buttons put there (CUSTOM_TAB_BUTTONS of the aui
demo).
I've tried to add this line:

self.Bind(aui.EVT_AUINOTEBOOK_BUTTON,self.OnTry)

in the BindEvents method in the aui demo but nothing happens when I
click on the sort button or any of the others. By the way this is
OnTry

def OnTry(self,evt):
    print 'here it is'
    evt.Skip()

Marco

···

On 11 Ago, 18:02, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

On 11 August 2011 17:04, Marco Prosperi wrote:

> hi all, how can I bind event handlers to tab are buttons in the
> agw.auinotebook?

The source code is your friend:

EVT_AUINOTEBOOK_BG_MIDDLE_DOWN =
wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_MIDDLE_DOWN, 1)
""" The user middle-clicked in the tab area but not over a tab or a button.
"""
EVT_AUINOTEBOOK_BG_MIDDLE_UP =
wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_MIDDLE_UP, 1)
""" The user middle-clicked in the tab area but not over a tab or a button.
"""
EVT_AUINOTEBOOK_BG_RIGHT_DOWN =
wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_RIGHT_DOWN, 1)
""" The user right-clicked in the tab area but not over a tab or a button.
"""
EVT_AUINOTEBOOK_BG_RIGHT_UP =
wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_RIGHT_UP, 1)
""" The user right-clicked in the tab area but not over a tab or a button.
"""
EVT_AUINOTEBOOK_BG_DCLICK =
wx.PyEventBinder(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, 1)
""" The user left-clicked on the tab area not occupied by `AuiNotebook`
tabs. """

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/

Hi,

thank you for the prompt answer but I haven’t found the solution yet.

I don’t want to bind an event handler to clicks on the background of

auitabctrl but to the buttons put there (CUSTOM_TAB_BUTTONS of the aui

demo).

I’ve tried to add this line:

self.Bind(aui.EVT_AUINOTEBOOK_BUTTON,self.OnTry)

in the BindEvents method in the aui demo but nothing happens when I

click on the sort button or any of the others. By the way this is

OnTry

def OnTry(self,evt):

print 'here it is'

evt.Skip()

Try this:

auibook.AddTabAreaButton(ids, wx.LEFT, btn.GetBitmap())

auibook.Bind(aui.EVT_AUINOTEBOOK_BUTTON, self.OnButton)

def OnButton(self, event):

if event.GetInt() == aui.AUI_BUTTON_CLOSE:

event.Skip()

return

print “Button!”, event.GetInt()

Andrea.

“Imagination Is The Only Weapon In The War Against Reality.”
http://xoomer.alice.it/infinity77/

==> Never EVER use RemovalGroup for your house removal. You’ll regret it forever.

http://thedoomedcity.blogspot.com/2010/03/removal-group-nightmare.html <==

···

On 12 August 2011 00:25, Marco Prosperi wrote:

thank you, it works!
Another issue with tabareactrl: if I have custom tab area buttons in
my tabctrl, when I drag a tab in another position I don't have the
custom tab area buttons in the new tabctrl (it should be a 'tabframe',
if I understand correctly the source). Is there a straight way to have
the custom buttons also in the new tabctrl?

Marco

···

On 11 Ago, 23:58, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

On 12 August 2011 00:25, Marco Prosperi wrote:

> thank you for the prompt answer but I haven't found the solution yet.
> I don't want to bind an event handler to clicks on the background of
> auitabctrl but to the buttons put there (CUSTOM_TAB_BUTTONS of the aui
> demo).
> I've tried to add this line:

> self.Bind(aui.EVT_AUINOTEBOOK_BUTTON,self.OnTry)

> in the BindEvents method in the aui demo but nothing happens when I
> click on the sort button or any of the others. By the way this is
> OnTry

> def OnTry(self,evt):
> print 'here it is'
> evt.Skip()

Try this:

auibook\.AddTabAreaButton\(ids, wx\.LEFT, btn\.GetBitmap\(\)\)
auibook\.Bind\(aui\.EVT\_AUINOTEBOOK\_BUTTON, self\.OnButton\)

def OnButton\(self, event\):

    if event\.GetInt\(\) == aui\.AUI\_BUTTON\_CLOSE:
        event\.Skip\(\)
        return

    print &quot;Button\!&quot;, event\.GetInt\(\)

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll regret it
forever.http://thedoomedcity.blogspot.com/2010/03/removal-group-nightmare.html&lt;==

Hi,

thank you, it works!
Another issue with tabareactrl: if I have custom tab area buttons in
my tabctrl, when I drag a tab in another position I don't have the
custom tab area buttons in the new tabctrl (it should be a 'tabframe',
if I understand correctly the source). Is there a straight way to have
the custom buttons also in the new tabctrl?

No, not yet, although I don't think it will be difficult to implement.
Ill take a look at it when I get back home.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

···

On 15 August 2011 23:57, Marco Prosperi wrote:

import wx

I give more complete information on what I'm trying to do in case
there is a different solution to the same problem making you spend
less time: I'm exploring the possibility to pass may application old
GUI (MDI with a MDIChild selector) to agw.aui.notebook. In this
transformation I would like to remove the bulky toolbar that I have in
every MDIChild with a popup menu containing the same entries of the
toolbar. I was trying to open this popup by means of a tab area button
but also a button on a tab could be good (in this order: my button for
popup, tab label, close button). But it looks to me that also this
solution would require some work on the library, not just subclassing
and overloading some methods by me. I know that the most
straightforward way to manage the popup would be using a right click
event handler on the tab but it would be less intuitive than the
button and the GUI would appear less rich

Marco

···

On 16 Ago, 12:17, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

On 15 August 2011 23:57, Marco Prosperi wrote:

> thank you, it works!
> Another issue with tabareactrl: if I have custom tab area buttons in
> my tabctrl, when I drag a tab in another position I don't have the
> custom tab area buttons in the new tabctrl (it should be a 'tabframe',
> if I understand correctly the source). Is there a straight way to have
> the custom buttons also in the new tabctrl?

No, not yet, although I don't think it will be difficult to implement.
Ill take a look at it when I get back home.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/

>>> import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

>>> import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

>>> import wx

Hi,

I give more complete information on what I'm trying to do in case
there is a different solution to the same problem making you spend
less time: I'm exploring the possibility to pass may application old
GUI (MDI with a MDIChild selector) to agw.aui.notebook. In this
transformation I would like to remove the bulky toolbar that I have in
every MDIChild with a popup menu containing the same entries of the
toolbar. I was trying to open this popup by means of a tab area button
but also a button on a tab could be good (in this order: my button for
popup, tab label, close button). But it looks to me that also this
solution would require some work on the library, not just subclassing
and overloading some methods by me. I know that the most
straightforward way to manage the popup would be using a right click
event handler on the tab but it would be less intuitive than the
button and the GUI would appear less rich

The last version of AUI in SVN now copies over the custom tab area
button to the newly created AuiBook, whether the split has been caused
by drag and drop or by actually calling Split() from the code.

Please let me know if it is what you were asking for.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

···

On 16 August 2011 16:49, Marco Prosperi wrote:

import wx

sorry for my delayed feedback but here it is: it works fine and I've
put together a little prototype for verifying also other features
before the changeover of my application GUI

thank you for this and for all your great work on agw

Marco

···

On 16 Ago, 18:40, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

On 16 August 2011 16:49, Marco Prosperi wrote:

> I give more complete information on what I'm trying to do in case
> there is a different solution to the same problem making you spend
> less time: I'm exploring the possibility to pass may application old
> GUI (MDI with a MDIChild selector) to agw.aui.notebook. In this
> transformation I would like to remove the bulky toolbar that I have in
> every MDIChild with a popup menu containing the same entries of the
> toolbar. I was trying to open this popup by means of a tab area button
> but also a button on a tab could be good (in this order: my button for
> popup, tab label, close button). But it looks to me that also this
> solution would require some work on the library, not just subclassing
> and overloading some methods by me. I know that the most
> straightforward way to manage the popup would be using a right click
> event handler on the tab but it would be less intuitive than the
> button and the GUI would appear less rich

The last version of AUI in SVN now copies over the custom tab area
button to the newly created AuiBook, whether the split has been caused
by drag and drop or by actually calling Split() from the code.

Please let me know if it is what you were asking for.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.alice.it/infinity77/

>>> import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

>>> import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

>>> import wx

[Andrea: first, thank you for all you do for wxPython ...]

I got excited about this thread because I too have wanted to be able to put
toolbar buttons and menu items to the wasted space to the right of notebook
tabs. But after looking at the AuiNotebook API, it seems it applies only to
certain predefined buttons.

May I be presumptuos and suggest that a great and more general solution
would be to be able to place an AGW ButtonPanel control on the notebook in
the empty space right or left of the page tabs?

···

--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/auinotebook-tab-area-buttons-tp4689840p5053518.html
Sent from the wxPython-users mailing list archive at Nabble.com.

Hi,

[Andrea: first, thank you for all you do for wxPython ...]

I got excited about this thread because I too have wanted to be able to put
toolbar buttons and menu items to the wasted space to the right of notebook
tabs. But after looking at the AuiNotebook API, it seems it applies only to
certain predefined buttons.

May I be presumptuos and suggest that a great and more general solution
would be to be able to place an AGW ButtonPanel control on the notebook in
the empty space right or left of the page tabs?

This is a good idea but it is going to be tough to implement,
especially with all the fancy tabs/text measurements going on behind
the scenes. Buttons are easy to add/remove as they always have the
same size, plugging in a generic control and make it play nice with
the layout is going to be a pain. But Ill see what I can do when I get
some time. Of course, patches are always more than welcome.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On 6 December 2011 22:27, BobTP37 wrote: