Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Canvas.copy passes unexpected "visible" keyword

edited March 7 in OpenSesame

Hi @sebastiaan,

Not sure whether this is a bug, or something related due to my trying to revive an ancient OpenSesame script in a newer version, but see below:

Error while executing inline script

item-stack: experiment[run].instructions_02[run]
exception type: TypeError
exception message: __init__() got an unexpected keyword argument 'visible'
item: instructions_02
time: Wed Mar  6 17:15:12 2019
phase: run

Traceback:
  File "/usr/lib/python2.7/dist-packages/libopensesame/inline_script.py", line 96, in run
    self.experiment.python_workspace._exec(self.crun)
  File "/usr/lib/python2.7/dist-packages/libopensesame/base_python_workspace.py", line 124, in _exec
    exec(bytecode, self._globals)
  Inline script, line 30, in <module>
  File "/usr/lib/python2.7/dist-packages/openexp/_canvas/legacy.py", line 158, in copy
    Canvas.copy(self, canvas)
  File "/usr/lib/python2.7/dist-packages/openexp/_canvas/canvas.py", line 757, in copy
    for name, element in canvas._elements.items()
  File "/usr/lib/python2.7/dist-packages/openexp/_canvas/_element/legacy.py", line 47, in copy
    return self.__class__(canvas, **properties)
TypeError: __init__() got an unexpected keyword argument 'visible'


Looks like `Canvas.__init__` is passed a `visible` keyword argument through `Canvas.copy`. For context, this is the relevant code from the offending inline script:

intro_mouse = mouse(self.experiment)
intro_keyboard = keyboard(self.experiment, keylist = ["space"])
intro_canvas = canvas(self.experiment)
intro_canvas.set_font('mono',12)
intro_canvas_copy = canvas(self.experiment)

intro_canvas.clear()

intro_canvas.text("Some instructions",center=False,x=64,y=64,color='black')
intro_canvas.text("Some further instructions",center=True,x=(self.get("width")/2),y=(self.get("height")/2 + 75),color='black')

intro_canvas.image("example.png", center=True, x=(self.get("width")/2), y=((self.get("height")/2)))

intro_canvas.show()

intro_canvas_copy.copy(intro_canvas)


Comments

  • PS: What happened to the Markdown and/or html support?!

  • Hi Edwin,

    Right this is a known issue, but it has been fixed now.

    > PS: What happened to the Markdown and/or html support?!

    The new version of Vanilla (the forums software) has a new rich editor that allows you to apply formatting directly. However, it's a bit annoying that the `Markdown` functionality indeed seems to be gone. I'll see if I can re-enable that.

    Cheers,

    Sebastiaan

  • Ah, brilliant, thanks! I'll grab the latest code then :)

Sign In or Register to comment.