Popup menu look and feel changes when using bitmaps for menu items

Hi all,

I’d like to create a popup menu having items with the following background :

But when I define a bitmap for an item with method “SetBitmap” the popup menu and item background styles completely change :

Has anyboby already seen this kind of behavior ?

Regards.

Looks like it's Windows, correct? Which version of wxPython is it? (You should always mention platform and version when asking about problems.)

···

On 11/28/12 2:33 AM, Thierry wrote:

Hi all,

I'd like to create a popup menu having items with the following background :

<https://lh3.googleusercontent.com/-m-Olw-v83uk/ULXlVErtpUI/AAAAAAAAAIA/vmbwCGZTBsU/s1600/capture_menu_item_1.PNG&gt;

But when I define a bitmap for an item with method "SetBitmap" the popup
menu and item background styles completely change :

<https://lh6.googleusercontent.com/-LUVV_iuAujQ/ULXl3QyDfbI/AAAAAAAAAII/G-8bdmBMTpE/s1600/capture_menu_time_2.PNG&gt;

Has anyboby already seen this kind of behavior ?

--
Robin Dunn
Software Craftsman

Hi Robin,

Yes, you’re right. I’m working on Windows 7 with wxPython 2.8.12.1 (unicode) for Python 2.7.

Is this a known bug ? Has It been corrected in earlier versions of wxPython ?

May be I’ve missed something in menu or item configuration ?

···

Le mercredi 28 novembre 2012 19:47:51 UTC+1, Robin Dunn a écrit :

On 11/28/12 2:33 AM, Thierry wrote:

Hi all,

I’d like to create a popup menu having items with the following background :

<https://lh3.googleusercontent.com/-m-Olw-v83uk/ULXlVErtpUI/AAAAAAAAAIA/vmbwCGZTBsU/s1600/capture_menu_item_1.PNG>

But when I define a bitmap for an item with method “SetBitmap” the popup

menu and item background styles completely change :

<https://lh6.googleusercontent.com/-LUVV_iuAujQ/ULXl3QyDfbI/AAAAAAAAAII/G-8bdmBMTpE/s1600/capture_menu_time_2.PNG>

Has anyboby already seen this kind of behavior ?

Looks like it’s Windows, correct? Which version of wxPython is it?
(You should always mention platform and version when asking about problems.)


Robin Dunn

Software Craftsman

http://wxPython.org

It works fine for me in the PopupMenu sample in the demo using 2.9.4, try upgrading. IIRC the menu has to go into owner-drawn mode on Windows when an icon is used, and in 2.8 and prior it was using some simple drawing code in wx to emulate the native look of the menu, which worked fine in XP and earlier. Now I think it is using theme APIs to do the drawing so it should match the native look, as long as themes are enabled.

···

On 11/28/12 11:51 PM, Thierry Brizzi wrote:

Hi Robin,

Yes, you're right. I'm working on Windows 7 with wxPython 2.8.12.1
(unicode) for Python 2.7.

Is this a known bug ? Has It been corrected in earlier versions of
wxPython ?

--
Robin Dunn
Software Craftsman

Ok, I’ll have a look to this version. Thanks for all.

···

Le vendredi 30 novembre 2012 19:34:32 UTC+1, Robin Dunn a écrit :

On 11/28/12 11:51 PM, Thierry Brizzi wrote:

Hi Robin,

Yes, you’re right. I’m working on Windows 7 with wxPython 2.8.12.1

(unicode) for Python 2.7.

Is this a known bug ? Has It been corrected in earlier versions of

wxPython ?

It works fine for me in the PopupMenu sample in the demo using 2.9.4,
try upgrading. IIRC the menu has to go into owner-drawn mode on Windows
when an icon is used, and in 2.8 and prior it was using some simple
drawing code in wx to emulate the native look of the menu, which worked
fine in XP and earlier. Now I think it is using theme APIs to do the
drawing so it should match the native look, as long as themes are enabled.


Robin Dunn

Software Craftsman

http://wxPython.org

Another solution is to use wx.lib.agw.flatmenu module. Moreover, It doesn’t require a 2.9 release.

···

Le mardi 4 décembre 2012 08:47:22 UTC+1, Thierry Brizzi a écrit :

Ok, I’ll have a look to this version. Thanks for all.

Le vendredi 30 novembre 2012 19:34:32 UTC+1, Robin Dunn a écrit :

On 11/28/12 11:51 PM, Thierry Brizzi wrote:

Hi Robin,

Yes, you’re right. I’m working on Windows 7 with wxPython 2.8.12.1

(unicode) for Python 2.7.

Is this a known bug ? Has It been corrected in earlier versions of

wxPython ?

It works fine for me in the PopupMenu sample in the demo using 2.9.4,
try upgrading. IIRC the menu has to go into owner-drawn mode on Windows
when an icon is used, and in 2.8 and prior it was using some simple
drawing code in wx to emulate the native look of the menu, which worked
fine in XP and earlier. Now I think it is using theme APIs to do the
drawing so it should match the native look, as long as themes are enabled.


Robin Dunn

Software Craftsman

http://wxPython.org

You might try running the small menu example code that was posted a few minutes ago; it is a tiny sample code that uses a bitmap, and you can see if it has the same problem. For what it’s worth, when I run this on my system (Windows 7, wx 2.9.1.1), it does not have the problem that you have a picture of above.

The topic is “Windows: is there a way to force a menu width to be updated?”

···

On Wednesday, November 28, 2012 5:33:06 AM UTC-5, Thierry Brizzi wrote:

Hi all,

I’d like to create a popup menu having items with the following background :

But when I define a bitmap for an item with method “SetBitmap” the popup menu and item background styles completely change :

Has anyboby already seen this kind of behavior ?

Regards.