Archived posts, use them to search

Re: VPL: How to run a graphical tkinter (Python) program

by Smita Shrivastava -
Number of replies: 1

Hi Juan Carlos,

Thank you very much! I have added this script and I am now able to take user input and pass the input to turtle functions. I had a few more questions related to this -
1) In case of an error, I don't see an error message on the console anymore. Is there a way to enable this?
2) The UI closes immediately after the code is executed. I have currently added sleep() at the end of the code in order to see the output on the UI. Is there a way to make the UI stay a little longer so that the output could be observed without adding sleep().
3) Is there a way to set the screen size and location for the console as well as the UI?

I also had a question on the image formats that are supported -
4) I am trying to add a shape to the turtle using turtle.shape(imagename) and I am able to add .gif images but not other formats. Is there a restriction on the image format that could be used in VPL?

I also had a question on Input for Java programs -
5) I am doing a similar exercise in Java where I am taking user input and using it on the UI. For this I am currently using javax.swing.JOptionPane to take user inputs. Is there a similar script that I can use to take user inputs via console and use it for output on the UI?

Thank you again for your help!

Best Regards
Smita Shrivastava

In reply to Smita Shrivastava

Re: VPL: How to run a graphical tkinter (Python) program

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers

I will try to answer your questions:
A1) You can add a "read" command to wait for the "return key"
echo "read"" >>vpl_execution
add after  "echo python3 ...
A2) I think that this issue about programming and not related to VPL or the custom script.
A3) Sorry, but I don't know.
A4) No. VPL manages as binary the image files with the following file extensions: gif, jpg, jpeg, png, ico. The use of these files programmatically is not related to VPL.
A5) No, I don't have a similar solution for Java. Notice that I have a specific script to resolve your problem with Python because a colleague had the same problem, and I wrote the script for him. We are planning to develop a global solution but not yet done.

best regards,
Juan Carlos.