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

Edit figure parameters: TypeError: argument 1 has unexpected type 'list' #1690

Closed
mspacek opened this issue Jan 20, 2013 · 5 comments
Closed

Comments

@mspacek
Copy link
Contributor

mspacek commented Jan 20, 2013

Using a tuple to designate a single colour in a plot command, like this:

plot(range(10), c=(0.5, 0.5, 0.5))

and then clicking on the "Edit curves line and axes parameter" button raises this TypeError:

Traceback (most recent call last):
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/backend_qt4.py", line 577, in edit_parameters
    figureoptions.figure_edit(axes, self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/figureoptions.py", line 134, in figure_edit
    icon=get_icon('qt4_editor_options.svg'), apply=apply_callback)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 514, in fedit
    dialog = FormDialog(data, title, comment, icon, parent, apply)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 431, in __init__
    self.formwidget.setup()
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 403, in setup
    widget.setup()
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 378, in setup
    widget.setup()
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 285, in setup
    field.addItems(value)
TypeError: QComboBox.addItems(QStringList): argument 1 has unexpected type 'list'

This is very related to #917.

@mspacek
Copy link
Contributor Author

mspacek commented Jan 25, 2013

I just discovered that this:

plot(range(10), range(10), 'k', marker='o', ms=3)

also raises the exact same traceback and error:

Traceback (most recent call last):
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/backend_qt4.py", line 577, in edit_parameters
    figureoptions.figure_edit(axes, self)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/figureoptions.py", line 134, in figure_edit
    icon=get_icon('qt4_editor_options.svg'), apply=apply_callback)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 514, in fedit
    dialog = FormDialog(data, title, comment, icon, parent, apply)
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 431, in __init__
    self.formwidget.setup()
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 403, in setup
    widget.setup()
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 378, in setup
    widget.setup()
  File "/home/mspacek/src/matplotlib/lib/matplotlib/backends/qt4_editor/formlayout.py", line 285, in setup
    field.addItems(value)
TypeError: QComboBox.addItems(QStringList): argument 1 has unexpected type 'list'

@mspacek
Copy link
Contributor Author

mspacek commented Jan 25, 2013

However, if I use

plot(range(10), range(10), 'k-o', ms=3)

instead, I get the exact same plot, and no error when I click on the "edit curve line and axes parameters button"

@efiring
Copy link
Member

efiring commented Jan 28, 2013

Confirmed with v1.2.x. I think this limitation has always been present.

mdboom added a commit that referenced this issue May 24, 2013
qt4_editor formlayout now works with colour tuples (fixes Issue #1690)
@mdboom
Copy link
Member

mdboom commented May 24, 2013

Closed by #2017.

@mdboom mdboom closed this as completed May 24, 2013
@mspacek
Copy link
Contributor Author

mspacek commented May 24, 2013

Thanks! That fixed the TypeError in both cases in the first post. But when I do this:

plot(range(10), c=(0.5, 0.5, 0.5))

and then click on the "Edit curves line and axes parameter" button, the line and marker colours show up as my default black instead of grey, so the dialog isn't being updated properly. Hitting Apply or OK changes them to black, without me actually changing anything in the dialog. Not a big deal though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants