Robin made the following statement: My guess we are not doing it
correctly on windows.
Menus are provided by the system and may or may not support changing
visible attributes like the font. If it is supported for the platform
then the way it needs to be done is to use the form of the|Append|method
that takes a|wx.MenuItem|parameter instead of the the|Append|that is
normally used. LIke this:
|item = wx.MenuItem(id=103, text="&Earth", helpString="Select Earth")
item.SetFont(wx.Font(wx.FontInfo(10).Bold())) menu.Append(item) |
On 10/16/19 10:39 AM, johnf wrote:
Hi,
Windows 10, python 3.7.5, wxPython 4.0.6
I ran into the following:
User opens a form and the form immediately crashes/shuts down. This
occurs only if and when the font size is changed from the view menu
or ctrl ++ and then saved - when the form is reopened (then it
crashes) on Windows. It does not happen all the time just most of the
time.
I was able to trace the issue to the dMenuItem. I believe the issue
is due to wx.MenuItem does not have a "setFontSize" (or it does not
work) and when the form did open the python just allowed the error.
So I changed the following:
dPemMixin->_restoreFontZoom() adding dMenuItem to the not isinstance()
def _restoreFontZoom(self):
"""Called when object is instantiated: restore the zoom based
on the form."""
if not hasattr(self.Form, "_currFontZoom"):
self.Form._restoreFontZoom()
zoom = getattr(self.Form, "_currFontZoom", 0)
dPanel = dabo.import_ui_name("dPanel")
dScrollPanel = dabo.import_ui_name("dScrollPanel")
#jfcs 10/16/2019 added below dMenuItem because it was causing
dabo to crash
dMenuItem = dabo.import_ui_name('dMenuItem')
if zoom and not isinstance(self, (dPanel, dScrollPanel,
dMenuItem)):
dabo.ui.callAfter(self._setAbsoluteFontZoom, zoom)
Johnf
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: https://leafe.com/archives
This message:
https://leafe.com/archives/byMID/[email protected]