Correct serrated or burr losangle after drawing a diamond polygon

David McFarlane mcfarla9 at msu.edu
Mon Jan 13 21:20:27 UTC 2014


Camila,

If you are already comfortable with Python, and are really intent 
about learning how to code, then I highly recommend PsychoPy, 
psychopy.org .  That might make a better platform than E-Prime for 
your interests.

All the best,
-- David


At 1/13/2014 04:01 PM Monday, Camila Gomes Victorino wrote:

>Dear David,
>
>I would like to learn code and it is because of that I prefer to use Inline.
>About the "write" think, I just put on that way to try to explain 
>what I wanted to do (I know you don't do this in this way).
>
>It has been just a month since I first began to program. It is fact 
>I need courses and as you don't know me, there is the possibility I 
>will be unable to understand your responses about any other code you 
>could be able to write about my doubts but, really? Do you really 
>need to answer in this way? I am learning and off course I will 
>write dumb mistakes but it does not mean someone could help me to 
>understand, instead of saying "I get the feeling that you need to get a fair
>
>bit of background knowledge before anything said here will help." I 
>know I need background! Off course! If I didn't why would I be here 
>in this forum and using E-prime?  I will use Python straight ahead!
>
>Finally, I've never thought to do this on my own and it is because 
>of that I entered on this forum.
>
>Anyway, best for you too and thank you for the tips and links!
>
>
>
>Em segunda-feira, 13 de janeiro de 2014 19h59min07s UTC, McFarlane, 
>David escreveu:
>Camila,
>
>Just a few comments...
>
>1) I really do not get why you do not want to do this with Slides,
>and then get rid of all the inline code.
>
>2) Lines like
>      c.getattrib("TargetImage") = "DiamondLeft.bmp"
>are illegal.  c.getattrib("TargetImage") returns a value, and it
>makes no sense to assign a value to a returned value.  If you have
>trouble with that, then it means that you need to take a course in
>Introduction to Programming.
>
>3) Judging from other mistakes (e.g., '"WRITE" = "DiamondLeft.bmp"',
>which makes no sense), I get the feeling that you need to get a fair
>bit of background knowledge before anything said here will
>help.  Once again, this points toward taking a course in Introduction
>to Programming.
>
>4) But if you really want to do it on your own, then start with the
>general comments at 
><https://groups.google.com/d/topic/e-prime/VCXgOWjKtCg>https://groups.google.com/d/topic/e-prime/VCXgOWjKtCg 
>.
>
>Best,
>-- David McFarlane
>
>
>At 1/13/2014 11:10 AM Monday, Camila Gomes Victorino wrote:
> >Hi David!
> >Thank you for your answer!
> >As I wrote my TrialProc as a queue of InLines (each one composing a
> >canvas, showing different figures until feedback), using the Slide
> >Image would create other canvas, different from the others and I
> >don`t know if it is possible to mix two canvas in one, for example,
> >some inline figures to the Images in SlideImage, all at once, so
> >I employed your idea, creating two images.bmp (one with left diamond
> >and right square and other with right diamond and left square) and
> >created a row in the TrialList, called TargetImage, linking each
> >image file to a specific target in the trialList. After that, I came
> >back to the Inline where the serrated diamond was written and tried
> >to write the code to load and show this two images, based on the
> >TrialList. The problem is I am having trouble to discover what to do.
> >
> >In the part where the serrated diamond was written, I changed to:
> >'Show targets
> >If c.getattrib("Target") = "Diamond" Then
> >c.getattrib("TargetImage") = "DiamondLeft.bmp"
> >Else
> >'Write a Diamond
> >c.getattrib("TargetImage") = "DiamondRight.bmp"
> >End If
> >
> >When I compile it says: "Can't assign to constant". I suspect I need
> >to load the images first but I don`t know how to do it! Or I need to
> >declare and set the bmp file (no clues!!).
> >
> >Other solution I figured out was to write a code to load and show
> >the images directly. For example:
> >'Show targets
> >If c.getattrib("Target") = "Diamond" Then
> >"WRITE" = "DiamondLeft.bmp"
> >Else
> >'Write a Diamond
> >"WRITE" = "DiamondRight.bmp"
> >End if
> >
> >The problem is I tried everything! I went to E-prime Help and copied
> >and tried to use Canvas.LoadImage, ImageDisplay.Filename and
> >ImageDisplay.Load but I`ve never succeed!
> >Maybe it is a simple answer but I am a novice in programming. Any advice?
> >
> >Thank you for your help!
> >Regards, Camila.
> >
> >Em quinta-feira, 9 de janeiro de 2014 19h24min20s UTC, McFarlane,
> >David escreveu:
> >Hmm.  I normally decline to look at extensive code samples or
> >attached programs, but you made it very easy and I was curious.  So I
> >ran your code, and indeed got bad jagged edges for the diamonds.  I
> >thought I could just attribute this to low Display resolution (640 x
> >480 default), but got the same bad results at all other resolutions
> >(max 1680 x 1050 on my machine), working with either EP1 or EP2.  So
> >it seems that the E-Basic Canvas.Polygon command simply does not do a
> >good job of anti-aliasing (see
> ><<http://en.wikipedia.org/wiki/Spatial_anti-aliasing>http://en.wiki 
> pedia.org/wiki/Spatial_anti-aliasing>http://en.wikipedia.org/wiki/Spatial_anti-aliasing 
>
> >for background information).
> >
> >Instead, you should make image files for your diamond and other
> >shapes, then simply load those images to the Display as needed.  This
> >has the advantage that you can use good software to prepare your
> >images and it will simplify your E-Basic code as you can simply
> >redraw the same image to different defined locations.
> >
> >Come to think of this, using image files and Slides, you should be
> >able to do this with no E-Basic code at all (I should have thought of
> >this first, as this is the norma E-Prime way!).  Just make a Slide
> >with SlideImage sub-objects to hold your square and diamond images,
> >then use attribute references from a List to assign the Position X &
> >Y properies for each of those sub-objects.  Easy-peasy (as long as
> >you do not need too many diamond angles)!
> >
> >-----
> >David McFarlane
> >E-Prime training
> >online:
> ><<http://psychology.msu.edu/Workshops_Courses/eprime.aspx>http://ps 
> ychology.msu.edu/Workshops_Courses/eprime.aspx>http://psychology.msu.edu/Workshops_Courses/eprime.aspx 
>
> >
> >Twitter:  @EPrimeMaster
> >(<<https://twitter.com/EPrimeMaster>https://twitter.com/EPrimeMaste 
> r>https://twitter.com/EPrimeMaster )
> >
> >/----
> >Stock reminder:  1) I do not work for PST.  2) PST's trained staff
> >take any and all questions at
> ><<https://support.pstnet.com>https://support.pstnet.com>https://sup 
> port.pstnet.com , and they
> >strive to respond to all requests in 24-48 hours, so make full use of
> >it.  3) In addition, PST offers several instructional videos on their
> >YouTube channel
> >(<<http://www.youtube.com/user/PSTNET>http://www.youtube.com/user/P 
> STNET>http://www.youtube.com/user/PSTNET
> >).  4) If you do
> >get an answer from PST staff, please extend the courtesy of posting
> >their reply back here for the sake of others.
> >\----
> >
> >
> >At 1/8/2014 09:56 AM Wednesday, Camila Gomes Victorino wrote:
> > >I have a binary decision making task where the subject needs to find
> > >out the diamond or losangle in one of the two sides. In the other
> > >one, there is a square and it needs to be identical to the diamond
> > >(just the angle position changes). I tried to draw the losangle and
> > >it worked, the problem is that the stimulus appears with serrated or
> > >burr sides. I tried to fix it putting the cnvs.penwidth and
> > >modifying it but it changes a lot the diamond and it needs to be
> > >identical to the square. I do not know how to fix it and get the
> > >serrated burrs out.
> > >
> > >I wrote the code as this:
> > >
> > >  'Declare variables
> > >Dim r, centerX, centerY As Integer
> > >
> > >'Create canvas
> > >Set cnvs = Display.Canvas
> > >cnvs.FillColor = CColor("White")
> > >cnvs.Clear
> > >
> > >'Create fixation point
> > >cnvs.TextColor = CColor ("black")
> > >cnvs.FontName = "Courier New"
> > >cnvs.FontSize = "18"
> > >cnvs.FontBold = CLogical("Yes")
> > >cnvs.Text 313, 228, "+"
> > >
> > >'Create gray squares
> > >cnvs.Pencolor = CColor("Gray")
> > >cnvs.Fillcolor = CColor("White")
> > >cnvs.Rectangle 255, 205, 55, 62
> > >cnvs.Rectangle Display.XRes -310, 205, 55, 62
> > >
> > >'Show targets
> > >cnvs.Pencolor = CColor("black")
> > >cnvs.Fillcolor = CColor("black")
> > >If c.getattrib("Target") = "Diamond" Then
> > >'Write a left diamond
> > >Dim P (4) As Point
> > >P(0).x = 280
> > >P(0).y = 218
> > >P(1).x = 296
> > >P(1).y = 239
> > >P(2).x = 280
> > >P(2).y = 256
> > >P(3).x = 265
> > >P(3).y = 239
> > >cnvs.Polygon P, 4
> > >
> > >cnvs.Rectangle 345, 222, 25, 30
> > >Else
> > >'Write a Rectangle
> > >cnvs.Rectangle 270, 222, 25, 30
> > >'Write a Diamond
> > >
> > >Dim L (4) As Point
> > >L(0).x = 357
> > >L(0).y = 218
> > >L(1).x = 373
> > >L(1).y = 239
> > >L(2).x = 357
> > >L(2).y = 256
> > >l(3).x = 342
> > >L(3).y = 239
> > >cnvs.Polygon L, 4
> > >
> > >
> > >End If
> > >
> > >Sleep (1000)
> > >
> > >Thank you!
> > >Best regards,
> >
> >--
> >You received this message because you are subscribed to the Google
> >Groups "E-Prime" group.
> >To unsubscribe from this group and stop receiving emails from it,
> >send an email to e-prime+u... at googlegroups.com.
> >To post to this group, send email to e-p... at googlegroups.com.
> >To view this discussion on the web visit
> ><<https://groups.google.com/d/msgid/e-prime/dcc3a442-d83a-421a-913f 
> -3dc15ec035fe%40googlegroups.com>https://groups.google.com/d/msgid/e-prime/dcc3a442-d83a-421a-913f-3dc15ec035fe%40googlegroups.com>https://groups.google.com/d/msgid/e-prime/dcc3a442-d83a-421a-913f-3dc15ec035fe%40googlegroups.com. 
>
> >For more options, visit
> ><<https://groups.google.com/groups/opt_out>https://groups.google.co 
> m/groups/opt_out>https://groups.google.com/groups/opt_out.
>
>--
>You received this message because you are subscribed to the Google 
>Groups "E-Prime" group.
>To unsubscribe from this group and stop receiving emails from it, 
>send an email to e-prime+unsubscribe at googlegroups.com.
>To post to this group, send email to e-prime at googlegroups.com.
>To view this discussion on the web visit 
><https://groups.google.com/d/msgid/e-prime/514b2dd0-659b-4bad-970e-3a61378e19e6%40googlegroups.com>https://groups.google.com/d/msgid/e-prime/514b2dd0-659b-4bad-970e-3a61378e19e6%40googlegroups.com.
>For more options, visit 
><https://groups.google.com/groups/opt_out>https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/52d458a1.2cdd320a.0aaf.ffff941eSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
For more options, visit https://groups.google.com/groups/opt_out.



More information about the Eprime mailing list