Skip to content

WxPython font dialog crashes after cancel #1130

@corranwebster

Description

@corranwebster

Environment

OS: all
Python version: 3.6
Toolkit:Wx

Description

When using a FontDialog under Wx, when you cancel you get a crash with a traceback like this:

Traceback (most recent call last):
  File "font_dialog.py", line 14, in <module>
    font = get_font(None, font='12 pt Helvetica sans-serif')
  File "/Users/cwebster/src/process/pyface/pyface/font_dialog.py", line 37, in get_font
    result = dialog.open()
  File "/Users/cwebster/src/process/pyface/pyface/i_dialog.py", line 168, in open
    self.close()
  File "/Users/cwebster/src/process/pyface/pyface/ui/wx/font_dialog.py", line 51, in close
    self.font = Font.from_toolkit(wx_font)
  File "/Users/cwebster/src/process/pyface/pyface/font.py", line 354, in from_toolkit
    return cls(**toolkit_font_to_properties(toolkit_font))
  File "/Users/cwebster/src/process/pyface/pyface/ui/wx/font.py", line 160, in toolkit_font_to_properties
    family = wx_family_to_generic_family[toolkit_font.GetFamily()]
wx._core.wxAssertionError: C++ assertion "IsOk()" failed at /Users/robind/projects/bb2/dist-osx-py36/build/ext/wxWidgets/src/common/fontcmn.cpp(407) in GetFamily(): invalid font

Steps to Reproduce

Install a Wx environment, run examples/dialogs/font_dialog.py in it, and cancel the dialog when it is done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions