Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy tabular editor demo has font issue #4

Closed
cfarrow opened this issue Jun 18, 2011 · 3 comments
Closed

Numpy tabular editor demo has font issue #4

cfarrow opened this issue Jun 18, 2011 · 3 comments
Labels
component: examples Issues related to example code

Comments

@cfarrow
Copy link
Contributor

cfarrow commented Jun 18, 2011

When running the demo at examples/demo/Advanced/NumPy_array_tabular_editor_demo.py I get the following exception when hovering over the table.

OnGetItemAttr
attr.SetFont( font )
File "/Library/Frameworks/Python.framework/Versions/7.0/lib/python2.7/site-packages/wx/_controls.py", line 4163, in SetFont
return controls.ListItemAttr_SetFont(_args, *_kwargs)
TypeError: in method 'ListItemAttr_SetFont', expected argument 2 of type 'wxFont const &'

Running from master on OSX 10.6.

@cfarrow
Copy link
Contributor Author

cfarrow commented Jun 18, 2011

Get the same exception from examples/demo/Application/Python_source_browser.py

@WarrenWeckesser
Copy link
Contributor

In this snippet from traitsui/wx/tabular_editor.py (lines 134-136),

    font = editor.adapter.get_font( object, name, row )
    if font is not None:
        attr.SetFont( font )

the adaper's get_font() method is returning the string "Courier 10", but the method attr.SetFont() expects a wx Font object. The example works if the line

font        = 'Courier 10'

is changed to

font        = Font('Courier 10')

I just pushed this change, and a similar change for Python_source_browser.py, so these examples should now work.

However, I think the TabularAdapter and/or backend-dependent editor should handle a string, since a Font trait is supposed to be able to handle being assigned a value such as "Courier 10", and the TabularAdapter knows that the special attribute called 'font' should be a Font trait.

@rahulporuri rahulporuri added the component: etsdemo Issues related to the etsdemo application label Aug 11, 2020
@kitchoi kitchoi added component: examples Issues related to example code and removed component: etsdemo Issues related to the etsdemo application labels Dec 18, 2020
@rahulporuri
Copy link
Contributor

closing as I can't reproduce this at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: examples Issues related to example code
Projects
None yet
Development

No branches or pull requests

4 participants