Howdy, Stranger!

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

Supported by

[open] LineWidth incorrect?

edited March 2015 in PyGaze

Hi folks

If I use 'psychopy' DISPTYPE and perform something like

tscr.draw_line(BGC,spos=(0,503),epos=(constants.DISPSIZE[0],503),pw=1)
tscr.draw_rect(colour=FGC, x=0, y=600, w=constants.DISPSIZE[0], h=1, pw=1, fill=True)

the draw_line produces a 2 pixels wide line whereas the draw_rect produces the desired 1 pixel wide straight line.

If I use 'pygame' I get the correct 1 pixel wide straight line, but at the end the program crashes with
Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

As I am using a simple GUI built with guidata, this crash is not acceptable, so I am forced to use psychopy, but this should work correctly.

Any idea of how to deal with this?

Thanks!

Comments

  • edited 5:07PM

    Hi Rjoos,

    I don't know what causes the 2 pixel width in this line of code. Will it become 4 pixels if you enter pw=2, and would it perhaps accept pw=0.5 to produce pixelwidth 1..?

    Anyway, you could try this: self.screen.append(Line(pygaze.expdisplay, start=(0,503), end=(constants.DISPSIZE[0],503), lineColor=colour, lineColorSpace='rgb', lineWidth=1))

    Or:
    stim = ShapeStim(pygaze.expdisplay, lineWidth=1, vertices=[spos, epos], lineColor='your_colour')

    self.screen.append(stim)

    Let me know if any of this works; otherwise we could turn to a developper to inquire about this!
    Good luck, cheers,
    Josh

  • edited 5:07PM

    Hi Josh

    Maybe I misunderstood your idea; however, if I try

    tscr.append(Line(pygaze.expdisplay, start=(0,530), end=(constants.DISPSIZE[0],530), lineColor=GBC, lineColorSpace='rgb', lineWidth=1))

    I get the error message:

    AttributeError: PsychoPyScreen instance has no attribute 'append'

    Did I implement it the wrong way?

    Roland

  • edited 5:07PM

    Hi Roland,

    The correct snippet would be the following:

    tscr.screen.append(Line(pygaze.expdisplay, start=(0,530), end=(constants.DISPSIZE[0],530), lineColor=GBC, lineColorSpace='rgb', lineWidth=1))
    

    In addition, we have moved away from using the Line class, as it was dysfunctional in newer versions of PsychoPy (not sure whether that is fixed yet). Instead, we opted for using the ShapeStim class with two vertices (starting and ending point of the line). You could try to use the Line class, and I would be very interested in knowing if this a) works and b) fixes your problem.

    If lines are invisible with a penwidth of 1, or aren't wide enough, than this is due to the underlying PsychoPy class. I suggest using a penwidth of 2 (or 3), if this isn't an issue in your GUI design. Alternatively, you could raise the issue on the PsychoPy mailing list.

    On the segfault in your PyGame script: that's a curious one, which most often occurs when PyQt4 and PyGame interact somehow. I am not familiar with the GUI library you mentioned, but this could result in a similar conflict. This is rather unsatisfying, but I don't know how to solve it (or even where to start looking).

    Good luck!

    Edwin

Sign In or Register to comment.