Howdy, Stranger!

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

Supported by

[open] Word processor style mouse behavior in text input?

edited August 2013 in OpenSesame

I am conducting an experiment where participants must provide a transcription for a short audio clip from memory. Is there any way to make the text_input widget allow interaction with the mouse, word processor style, as in allow a visible cursor, selection of text using the mouse, and clicking on the text to move the cursor and insert text? A participant may remember some of the middle of the stimulus after they have typed the end part already, and if this happens the default behavior will require them to delete everything they have typed back up to the point where they want to insert text. This may cause them to make mistakes or leave out information, which is really bad for me! Is there a way I can change this? Thanks for your help!

Comments

  • edited 12:51AM

    Hi Heather,

    No, I'm afraid that the form text_input widget only supports very basic interactions. This is because it's a custom widget set that has been designed from the ground up to work on a very wide range of systems and configurations. The downside of this approach is that it's quite slow and not as fancy as most modern GUI toolkits.

    Perhaps you could try the PsychoPy GUI functionality. This is also quite limited, but might be more suitable for your particular situation. The code snippet below can be placed into an inline_script item and will show a simple dialog box. This requires the psycho back-end.

    For more information, see:


    # This code snippet requires the psycho back-end
    from psychopy import gui
    # Define your questions in a dictionary
    info = {
        'Question' : 'Please enter some text',
        'Response' : ''
        }
    # Present a dialog
    infoDlg = gui.DlgFromDict(dictionary=info, title='Question', fixed=['Question'])
    if infoDlg.OK:
        # Set the dialog response ...
        exp.set('dialog_response', infoDlg['Response'])
    else:
        # unless the user pressed 'cancel'
        exp.set('dialog_response', None)
    

    Cheers!
    Sebastiaan

  • Thank you! I haven't gotten this to work as of yet, but I'm going to get someone with more Python knowledge to help me out.

    Heather

  • edited 12:51AM

    Hi Sebastiaan,

    So when I try this, using version 27.1 of OpenSesame, it runs, but when it comes to running the internal script item, it gives me an error message "Import Error: No module named wx". It seems that the internal version of Python does not include the wx module. Does this mean I have to run from source?

    Heather

  • edited 12:51AM

    Hi Heather,

    Ow right! I think there is a good chance that the wx module is included with the WinPython-based distribution of OpenSesame:

    Does this work? If not, you can manually the wx package to WinPython. That's easier than setting up an entire Python source environment yourself.

    There's also a forum discussion where you can post technical questions about using the WinPython distribution of OpenSesame (such as how to manually add a package):

    Cheers!
    Sebastiaan

  • edited 12:51AM

    Hi Sebastiaan,

    I tried using the latest version of the Python Portable release, but it still gave me the same error :( which looks like this:
    Error: Inline script error
    In: inline_script (run phase)
    File "dist\psychopy\gui.py", line 8
    Python traceback:
    ImportError: No module named wx

    In the debug window it said "ERROR: avbin.dll failed to load" and suggested I import psychopy.visual as the first item, and also to make sure avbin is installed. So I then added "from psychopy import visual" as the first line of the script, but it still failed with the same error.

    I am not sure how to check or install avbin, someone mentioned in that thread that modules could be installed using the "python setup.py install" command, but I tried putting "python setup.py install avbin" in there and that was incorrect syntax. Do you think avbin is the problem? If so, could you send me the line of code to run to install it? Sorry for being so Python-unknowledgable, I'm sure it's very simple but I'm not sure of the proper syntax.. thank you so much for your help!

  • edited 12:51AM

    Hi Heather,

    The avbin.dll error is annoying, but harmless. The problem is the missing wx module:

    The correct way to install a package in general is by opening a terminal (command prompt) in the folder where you have unzipped the package and execute:

    python setup.py install

    So you don't specify the package name in the command itself: This is already specified because you are calling the setup.py file included with that specific package.

    But as I mentioned, I would post the installation question in the OpenSesame-portable thread, so that @Edwin sees your question and can give you a more concrete instruction. Because things might work a little differently with WinPython (but not much).

    Cheers!
    Sebastiaan

  • edited 12:51AM

    Btw, I was thinking, you could also give Tk a shot. That's an older module that does pretty much the same thing as wx. The following script should present a text input dialog and store the response as my_response. I'm not sure how this will behave in a fullscreen experiment though, I suspect it will be highly system dependent. If the dialog doesn't appear or cause OpenSesame to crash, I would try another back-end and see whether that works.

    Cheers!

    # See also
    # <http://effbot.org/tkinterbook/entry.htm>
    import Tkinter
    master = Tkinter.Tk()
    master.title('Title')
    e = Tkinter.Entry(master)
    e.pack()
    e.focus_set()
    def callback():
        exp.set('my_response', e.get())
        master.destroy()
    b = Tkinter.Button(master, text="Ok", width=10, command=callback)
    b.pack()
    master.wait_window()
    
  • edited 12:51AM

    Hi Sebastiaan, I tried downloading wxPython but still had some troubles, so I posted my (extremely long) question to that thread. I tried the Tk script, it crashed with psycho.py backend, xperiment backend is apparently not compatible with my machine (something about OpenGL not being supported). With legacy backend it sort of worked, it brought me to a smaller window with a tiny little entry form that had the right behavior, and there was an Ok button. however, clicking the Ok button did nothing so there seemed to be no way to move forward in the experiment. It was close though! if you have any suggestions of how to modify this script so it might work, let me know, though hopefully @Edwin can help me with the other one.

    Thanks so much again for your help!!

    Heather

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games