Using Tkinter and Other Graphical Applications on Bowie

From Earlham CS Department
Revision as of 14:53, 11 April 2021 by Tjames19 (talk | contribs) (Created page with "= <span style="color:red"> Please Disregard Information on this Page, it is still under construction and will be completed soon!!!!</span> = When Running Tkinter on Bowie th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Please Disregard Information on this Page, it is still under construction and will be completed soon!!!!

When Running Tkinter on Bowie there are some steps one must complete before using the Package.

Tkinter for Mac Users

Tkinter is an X11 application thus one must:

CS Servers

  • Ensure Xquartz is installed on your machine and open the Xquartz terminal you will run all the following commands here.
  • Open the Tkinter terminal and type: xhost + (this relaxed the security of your system and opens it up for X11 forwarding)
  • SSH onto Bowie(tools) with the -Y option (this will allow for X11 Forwarding): ssh -Y <username>@bowie.cs.earlham.edu
  • Load a python environment, preferably one that is a newer version of python. It is not promised that tkinter will work for versions below 2.7: module load python/3.9
  • Create your python script do not name your script "tkinter.py"
  • At the top of the script type from Tkinter import *

Below is some test code to ensure everything is working. Create a python file in your terminal type in the script and run it: python3 <file name> from tkinter import *
window = Tk()
window.title("Welcome to My Tkinter app")
lbl = Label(window, text="Hello")
lbl.grid(column=0, row=0)
window.mainloop()

Personal Machine

  • Load a python environment, preferably one that is a newer version of python. It is not promised that tkinter will work for versions below 2.7: module load python/3.9
  • Create your python script do not name your script "tkinter.py"
  • At the top of the script type from Tkinter import *


A small window should appear on your computer named "Welcome to My Tkinter app" with the text "Hello" written inside the window.


Tkinter for Windows Users

CS Servers

No other application for Windows is needed you can run the commands below as is:

  • In your Ubuntu terminal SSH onto Bowie(tools) with the -Y option: ssh -Y <username>@bowie.cs.earlham.edu
  • Load a python environment, preferably one that is a newer version of python it is not promised that tkinter will work for versions below 2.7: module load python/3.9
  • Create your python script do not name your script "tkinter.py"
  • At the top of the script type from tkinter import *

Below is some test code to ensure everything is working. Create a python file in your terminal type in the script and run it: python3 <file name>


from tkinter import *
window = Tk()
window.title("Welcome to My Tkinter app")
lbl = Label(window, text="Hello")
lbl.grid(column=0, row=0)
window.mainloop()

A small window should appear on your computer named "Welcome to My Tkinter app" with the text "Hello" written inside the window.

Personal Machine

  • Load a python environment, preferably one that is a newer version of python. It is not promised that tkinter will work for versions below 2.7: module load python/3.9
  • Create your python script do not name your script "tkinter.py"
  • At the top of the script type from Tkinter import *

Issues

If you have any questions or issues feel free to contact the admins.