-
-
Notifications
You must be signed in to change notification settings - Fork 34
Using AREPL with GUI's
You can use Arepl with gui's like turtle and many others. Each time you edit the code the gui restarts, so to make it less annoying the AREPL automatically uses a longer delay after typing before restarting. The extra delay can be controlled in the settings. Or you can switch to execute on save/keybinding.
I also suggest coding it so the gui appears on the side (not blocking your view of your code), like so:
import turtle
turtle.setup(width=500, height=500, startx=-1, starty=0)
turtle.forward(100)
turtle.left(90)
Note that the GUI will steal focus from vscode, so if you do not already know it I highly suggest memorizing the shortcut to switch focus back to the previous application. (alt-tab on windows, command-tab on mac)
With PySimpleGui you can use the location paramater to control where the window appears:
import PySimpleGUI as sg
# 0,0 is top left
startx = 1000 # A higher value will make the window appear more on the right side of the screen
starty = 0
# window layout - see PySimpleGui documentation for more info
layout = [[sg.Text('Input:')], [sg.Input()], [sg.OK(), sg.Cancel()]]
# spawn the window
event, (input,) = sg.Window('Title', location=(startx,starty)).Layout(layout).Read()
f.canvas.manager.window.wm_geometry("+1200+0") #right-hand side
p5:
There are some outstanding bugs that will cause p5 animation library to fail. See https://github.com/Almenon/AREPL-backend/issues/31