wxPython mac: HSCROLL bug, Help menu bar item bug
7stud
bbxx789_05ss at yahoo.com
Sat Apr 14 14:12:07 PDT 2007
imac, os 10.4.7, python 2.4.4, wxPython from this download:
wxPython2.8-osx-unicode-2.8.3.0-universal10.4-py2.4.dmg
Since these bugs are somewhat difficult to find information about,
I thought I would make this post. I discovered them while playing
around with my first wxPython hello world program.
Apparently, specifying horizontal scroll bars with wxPython doesn't
work on macs:
-------------
import wx
app = wx.App()
my_win = wx.Frame(None)
my_panel = wx.Panel(my_win)
my_textArea = wx.TextCtrl(my_panel, style=wx.TE_MULTILINE | wx.HSCROLL)
my_win.Show()
app.MainLoop()
--------------
If you type a long sentence, no horizontal scroll bar will appear.
However, the default vertical scroll bar will appear if you hit
return a bunch of times.
The Help menu item bug is documented here:
http://article.gmane.org/gmane.comp.python.wax.user/120
It works this way. If I create a default menu bar like this:
------
import wx
app = wx.App()
my_win = wx.Frame(None)
menu_bar = wx.MenuBar()
my_win.SetMenuBar(menu_bar)
my_win.Show()
app.MainLoop()
-------
then the menu bar has these menu items:
Python Window
If I click on one of those menu items, a Help menu item
suddenly appears in the menu bar:
Python Window Help
I'm not really sure how ID's work, but the following code
overwrites the Python>About sub item:
---------
import wx
app = wx.App()
my_win = wx.Frame(None)
menu_bar = wx.MenuBar()
my_menu = wx.Menu()
my_menu.Append(wx.ID_ABOUT, "My Sub Item1")
my_menu.Append(1, "My Sub Item2")
menu_bar.Append(my_menu, "My Menu Item")
my_win.SetMenuBar(menu_bar)
my_win.Show()
app.MainLoop()
----------
However, similar code does not have the same effect on
the Help menu bar item(the one described above that
mysteriously appears when you first click on a menu bar
item):
---------
import wx
app = wx.App()
my_win = wx.Frame(None)
menu_bar = wx.MenuBar()
my_menu = wx.Menu()
my_menu.Append(wx.ID_HELP, "Where will this appear")
my_menu.Append(1, "My Sub Item2")
menu_bar.Append(my_menu, "My Menu Item")
my_win.SetMenuBar(menu_bar)
my_win.Show()
app.MainLoop()
---------
In this case, both Append()'ed items appear under "My Menu Item".
Now, what happens if I try to create my own Help menu bar item?
Will it overwrite the one that mysteriously appears?
---------
import wx
app = wx.App()
my_win = wx.Frame(None)
menu_bar = wx.MenuBar()
my_menu = wx.Menu()
my_menu.Append(1, "My Sub Item1")
my_menu.Append(2, "My Sub Item2")
menu_bar.Append(my_menu, "Help")
my_win.SetMenuBar(menu_bar)
my_win.Show()
app.MainLoop()
---------
When I click on the Help menu bar item I created, both sub items
display--but the other Help item mysteriously appears in the menu
bar as well, so my menu bar ends up looking like this:
Python Help Window Help
More information about the wxpython-users
mailing list