how create a dropdown button?

hi i can crate a dropdown button with wx.PaintDC or other device but i
not have idea how use it with a button

or if wxpython provides one?

Hi,

···

On Sep 15, 2009, at 5:57 PM, iozk_Live wrote:

hi i can crate a dropdown button with wx.PaintDC or other device but i
not have idea how use it with a button

or if wxpython provides one?

Do you mean like a downward triangle button?

You can draw it into a bitmap using a MemoryDc then create a BitmapButton with the bitmap you created.

Cody

Good evening,

You should take a look at the platebutton demo in the docs:
http://www.wxpython.org/download.php#binaries

This is nice because it has a SetMenu() and you don't have to deal
with the event or position yourself...

Also AUI has toolbars with dropdowns that are fairly easy to implement

PopupMenuOnRightClick - wxPyWiki is good reading for
help creating a menu

toothrot

···

On Sep 15, 5:57 pm, iozk_Live <iozk...@gmail.com> wrote:

hi i can crate a dropdown button with wx.PaintDC or other device but i
not have idea how use it with a button

or if wxpython provides one?

yes i want create the button like the wx.aui.AuiToolbar tools but sure
that i can`t create the toolbar

you don't have to have a standard docking-type toolbar to use the
auitoolbar buttons...

I have a couple in a wx.panel below a treectrl, here's a snapshot...

http://img38.imagefra.me/img/img38/2/9/16/f_14c2rj5xl0pm_0669a5d.png

I'm not quite sure what you mean to say though when you say that you
can't create a toolbar, can you elaborate?

···

On Sep 16, 4:29 pm, iozk_Live <iozk...@gmail.com> wrote:

yes i want create the button like the wx.aui.AuiToolbar tools but sure
that i can`t create the toolbar

yes like that picture that you show me is what i want to do is a
ribbon if i can create it but you know that the ribbon panels have a
big button with a dropdown menu and i want to use it with my programs
do you can showm e how do it? its the same way that create in the
auitoolbar?

You should check out ButtonPanel in the wxpython demos.

You can create a popup menu with any button, you just have to position
the wx.Menu correctly..

Most controls inherit methods to get their position on the screen or
client area. I use these to find the XY position of the button and
then add the height of the button. I think this will create the effect
you want. If you are stuck on using AUI, you can use larger bitmaps in
the toolbar buttons there too, see the AUI demo (it has a dropdown
example as well)

As you can see I strongly recommend getting the documentation (Demos).
It has many examples and is a good reference too. I still look to it
often for ideas on my UIs.

- michael

···

On Sep 19, 6:29 pm, iozk_Live <iozk...@gmail.com> wrote:

yes like that picture that you show me is what i want to do is a
ribbon if i can create it but you know that the ribbon panels have a
big button with a dropdown menu and i want to use it with my programs
do you can showm e how do it? its the same way that create in the
auitoolbar?

For this solution the code like:

        menu_button = evt.GetEventObject()
        pos = (menu_button.GetPosition()[0],
menu_button.GetPosition()[1] + menu_button.GetSize()[1])
        self.PopupMenu(self.menu1, pos)

works for me;
the function is bound to a button, which could as well be specified
directly, instead of evt.GetEventObject()
self.menu1 is the previously created wx.Menu with the needed items.

However, I use it to get an almost standard menu while saving the
space for the whole menu line.
I'm not sure, how far you get to implement a kind of ribbon this way;
probably aui or maybe FoldPanelBar are more powerful for this.

hth
  Vlasta

···

On Sep 19, 6:29 pm, iozk_Live <iozk...@gmail.com> wrote:

yes like that picture that you show me is what i want to do is a
ribbon if i can create it but you know that the ribbon panels have a
big button with a dropdown menu and i want to use it with my programs
do you can showm e how do it? its the same way that create in the
auitoolbar?

2009/9/20 michael h <michaelkenth@gmail.com>:

You can create a popup menu with any button, you just have to position
the wx.Menu correctly..
...
- michael

Hi,

2009/9/20 Vlastimil Brom:

yes like that picture that you show me is what i want to do is a
ribbon if i can create it but you know that the ribbon panels have a
big button with a dropdown menu and i want to use it with my programs
do you can showm e how do it? its the same way that create in the
auitoolbar?

You can create a popup menu with any button, you just have to position
the wx.Menu correctly..
...
- michael

For this solution the code like:

   menu\_button = evt\.GetEventObject\(\)
   pos = \(menu\_button\.GetPosition\(\)\[0\],

menu_button.GetPosition()[1] + menu_button.GetSize()[1])
self.PopupMenu(self.menu1, pos)

works for me;
the function is bound to a button, which could as well be specified
directly, instead of evt.GetEventObject()
self.menu1 is the previously created wx.Menu with the needed items.

However, I use it to get an almost standard menu while saving the
space for the whole menu line.
I'm not sure, how far you get to implement a kind of ribbon this way;
probably aui or maybe FoldPanelBar are more powerful for this.

I believe the best approach for a RibbonBar would be to wait for the
wxPython SWIG bindings for it (it already exists in wxWidgets trunk,
it was part of this year GSoC and it seems pretty nice and powerful).
In the unlikely event that I will have some spare time, I'll try a
translation of it from C++ to Python to let wxPython users familiarize
with it until Robin (or Kevin or some other SWIG guru) have some time
to create SWIG bindings for it.

Andrea.

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

···

On Sep 19, 6:29 pm, iozk_Live <iozk...@gmail.com> wrote:

2009/9/20 michael h <michaelkenth@gmail.com>: