Help Installing Python3 Tkinter

Please run this install on my project. :pray:

sudo apt-get install python3-tk
1 Like

TkInter wouldn’t work anyway as Glitch containers run in headless mode (CLI only), maning that GUIs wouldn’t work anyway.

Python 2.7.12 & Python 3.5.2 are installed in the Glitch container though. (As of writing this post)

Also, sudo access isn’t possible in the container. (I’m guessing it’s to stop people corrupting the containers)

I hope this answered your question.

1 Like

Thanks. I was planning to run Tk headless and stream the generated canvas via Node. I had hoped an admin would perform the required install. :roll_eyes:

root = tk.Tk()
canvas = tk.Canvas(root, borderwidth=0)
frame = tk.Frame(canvas)
#stream the frame via Node

1 Like

Ah I see, although if ran headless TkInter may throw some errors, although it should be possible to stream it to a frame.

Note: If you are using WebSockets I recommend you use wss:// if connecting to Glitch websockets as its more secure

1 Like

Hey @SirFizX, sorry I missed your last reply here. I’m afraid we won’t do project-specific installs due to the overhead that would require on our small staff. Particularly since your project won’t stay in the same container across every restart - in many cases when your project starts up it’s starting in a new base container, so that install would need to be rerun.

I definitely encourage you to make a suggestion in for us to consider in a future container refresh, though.

1 Like

@cori Hi, I am a python newb and I created a program that converts a excel file to csv and then emails the csv file. I am using tkinter to access the file directory of the local computer. If I cannot access tkinter, how can I access the file director?

You can used the standard library’s os module for direct file manipulations (rename, move, copy, delete, etc.) and then built-in file buffers for accessing files. For example:

with open('file/path.csv', 'r') as csv_file:
    # do some stuff with your csv_file

Hi @FlantasticDan,
Thank you for your reply! The suggestion that you offered is not applicable to the idea of the app that I want. I want the user to be able to see something like this …

. This way the user can choose the file in a nice manner. Do you know another way of replicating a similar interface?

With few exceptions the only way a user is going to be able to interact with your app on Glitch will be through their web browser, so you’ll have to use the various web technologies to interface with the user.

In practice that means Python will run your backend with something like Flask or Django and your frontend will be HTML/CSS/JS. This article from Mozilla talks about the client side file APIs:

1 Like

Hi @FlantasticDan,
Thank you for the advice! I will definitely incorporate into the development of my app!
Aryan Kini