wxMac problem: ToolBar in a Dialog

Hi all,

I’m trying to make a “Preferences” dialog that looks like most of Mac’s preferences dialogs (i.e the one in finder):

  • A toolbar with labels at the top - all items are radio items

  • Auto fit size when changing pages

Sounds like wx.ToolBook, but I wanted to keep support for wxPython 2.6 so I used wx.ToolBar and Andrea’s WidgetStack.

On windows it looks perfect :slight_smile:

On mac…

  1. There are no labels! (even though I used AddRadioLabelTool and set wx.TB_TEXT).

  2. Toolbar images are small (even though I used SetToolBitmapSize(wx.Size(32, 32)) ).

  3. Selected images have very ugly black background (This also happens on toolbars that are managed by a frame).

  4. Size never changes (even though I call Fit() when changing pages).

I’m also looking for wxPython applications designed especially for mac, any hint would be welcome :slight_smile:

Sample code attached.

Thanks in advance,

Roee.

test.py (3.26 KB)

WidgetStack.py (4.99 KB)

prefGeneral.png

Hi all,

I'm trying to make a "Preferences" dialog that looks like most of Mac's preferences dialogs (i.e the one in finder):
- A toolbar with labels at the top - all items are radio items
- Auto fit size when changing pages
Sounds like wx.ToolBook, but I wanted to keep support for wxPython 2.6 so I used wx.ToolBar and Andrea's WidgetStack.

On windows it looks perfect :slight_smile:
On mac...
1. There are no labels! (even though I used AddRadioLabelTool and set wx.TB_TEXT).

With the toolbook I can get the labels with wx.TB_TEXT, but they are really ugly. There must be another flag/style that the toolbook sets internally to get the text in the toolbar with TB_TEXT.

2. Toolbar images are small (even though I used SetToolBitmapSize(wx.Size(32, 32)) ).

You need to call SetToolBitmapSize before adding the tools for it to work.

3. Selected images have very ugly black background (This also happens on toolbars that are managed by a frame).

Using AddSimpleTool or AddLabelTool gets rid of the black background

4. Size never changes (even though I call Fit() when changing pages).

It changes size on my machine, I am using OSX 10.4.9, wxpython 2.8.4/py2.5

···

On Jun 11, 2007, at 2:45 PM, roee shlomo wrote:

I'm also looking for wxPython applications designed especially for mac, any hint would be welcome :slight_smile:

Sample code attached.
Thanks in advance,
Roee.
<test.py>
<WidgetStack.py>
<prefGeneral.png>
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Thanks Cody !

I have decided to use a frame instead of a dialog because of the labels issue.

  1. Selected images have very ugly black background (This also
    happens on toolbars that are managed by a frame).
    Using AddSimpleTool or AddLabelTool gets rid of the black background

Yes but I want them to be radio items, and setting kind=wx.ITEM_RADIO is exactly like AddRadioLabelTool. Too bad wxPython isn’t really native with toolbars on mac :frowning:

Thanks again for your help,

Roee.

···

On 6/12/07, Cody Precord codyprecord@gmail.com wrote:

On Jun 11, 2007, at 2:45 PM, roee shlomo wrote:

Hi all,

I’m trying to make a “Preferences” dialog that looks like most of

Mac’s preferences dialogs (i.e the one in finder):

  • A toolbar with labels at the top - all items are radio items
  • Auto fit size when changing pages
    Sounds like wx.ToolBook, but I wanted to keep support for wxPython

2.6 so I used wx.ToolBar and Andrea’s WidgetStack.

On windows it looks perfect :slight_smile:
On mac…

  1. There are no labels! (even though I used AddRadioLabelTool and
    set wx.TB_TEXT
    ).
    With the toolbook I can get the labels with wx.TB_TEXT, but they are
    really ugly. There must be another flag/style that the toolbook sets
    internally to get the text in the toolbar with TB_TEXT.
  2. Toolbar images are small (even though I used SetToolBitmapSize

(wx.Size(32, 32)) ).
You need to call SetToolBitmapSize before adding the tools for it to
work.
3. Selected images have very ugly black background (This also
happens on toolbars that are managed by a frame).

Using AddSimpleTool or AddLabelTool gets rid of the black background

  1. Size never changes (even though I call Fit() when changing pages).
    It changes size on my machine, I am using OSX 10.4.9, wxpython 2.8.4
    /
    py2.5

I’m also looking for wxPython applications designed especially for
mac, any hint would be welcome :slight_smile:

Sample code attached.
Thanks in advance,
Roee.

<test.py>
<WidgetStack.py>
<prefGeneral.png>

To unsubscribe, e-mail:
wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-
help@lists.wxwidgets.org


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org


http://code.google.com/p/lh-abc

Too bad wxPython isn't really native with toolbars on mac :frowning:

I think there is now (2.8) a native toolbar implementation, and it will be used if you use a standard toolbar-on-a-frame, rather than creating it independently.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

roee shlomo wrote:

Thanks Cody !
I have decided to use a frame instead of a dialog because of the labels issue.

     > 3. Selected images have very ugly black background (This also
     > happens on toolbars that are managed by a frame).
    Using AddSimpleTool or AddLabelTool gets rid of the black background

Yes but I want them to be radio items, and setting kind=wx.ITEM_RADIO is exactly like AddRadioLabelTool. Too bad wxPython isn't really native with toolbars on mac :frowning:

It is a native toolbar as long as you use frame.CreateToolBar or frame.SetToolBar, (Cmd-Click on the tic-tac on the frame's upper-right corner to see it in action) but the problem is that native Mac toolbars only allow one item to be 'selected' at a time in the whole toolbar. But since wx.ToolBar allows you to have more than one group of radio items that doesn't work because selecting an item in one group would deselect all items in other groups, so we had to come up with our own way to designate selected items and not use the native selection. Currently it's just modifying the bitmap on the fly.

BTW, I made a modification for OSAF where you can use a style flag to tell the toolbar to use native selection or not. So if you have just one group of radio items you can use that flag and have the full native look. I'll eventually be back-porting that change along with some other customizations done for OSAF, but it probably won't make it in to 2.8.x because of the binary compatibility requirement of the stable series.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!