Skip to main content

A package to create simple Tkinter-GUIs using a seperate textfile

Project description


A package to create simple Tkinter-GUIs using a seperate textfile


SimpleTk is a Class wich interprets a text file with fitting syntax to a tkinter GUI (just like Kivy).

from tkinter import * 
from SimpleTk import SimpleTk
root = Tk()
stk = SimpleTk(root, "project/testGUI.stk") # "gui.stk" is the standard value 
Changing Widget Properties
stk.buttonName1["text"] = "I'm a button"
stk.frameName1.bind("<Button-1>", lambda e: print("Click Event"))
File Syntax

In the additional text file you have to take care of the specific syntax. The current version is still sensitive to errors.

Important points:

  • use tab to indent child-widgets
  • No tabs at the end or middle of a line
  • command can't be added to the widget properties (must be added afterwards in the program code)
  • Use {3} to declare a maximum number of Columns for a parent-Widget (grid-geometry manager will be used inside that widget)
    • Lines without these brackets will use the pack-geometry manager to place child widgets
  • Use .. to type spaces in string arguments (a better solution is in work)
  • With > you can use this line to type pure python code (e.g. to call methods on a widget)
  • Use # to comment out the line from this point


  • General:
    • Widget-Class: WidgetName(Properties){Columns}
  • Example:
    • Label: label1(text="This is a label", bg="lightblue"){3}

To define a Childwidget just indent this line a line under the parent widget.


You can predefine paremters for specific Widgets:


  • General:
    • Style: WidgetName(Properties)
  • Example:
    • Style: Label(bg="lightgreen", fg="gold")

SimpleTk is a opportunity to outsource your fundamental GUI-implementation in an external file with clearer and more structured syntax. Especially when you have a huge design or you just want to test something.



frame1 = Frame(root, bg = "white")     
frame1.pack(padx = 5, pady = 5, expand = True, fill = BOTH)   

lf1 = LabelFrame(frame1, text = "Header", bg = "gold")  
lf1.grid(row = 0, column = 0, padx = 5, pady = 5, sticky = N+S+E+W)

label1 = Label(lf1, text = "My first GUI", bg = "lightblue")   
label1.grid(row = 0, column = 0, padx = 5, pady = 5, sticky = N+S+E+W)

button1 = Button(lf1, text = "This is a Button")   
button1.grid(row = 0, column = 1, padx = 5, pady = 5, sticky = N+S+E+W)

entry1 = Entry(lf1, bg = "white")  
entry1.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = N+S+E+W)

lf2 = LabelFrame(frame1, text = "Footer", bg = "gold")  
lf2.grid(row = 1, column = 0, padx = 5, pady = 5, sticky = N+S+E+W)

label2 = Label(lf2, text = "Footer", bg = "lightblue")    
label2.pack(padx = 5, pady = 5, expand = True, fill = BOTH)

cb1 = ttk.Combobox(lf2)
cb1.pack(padx = 5, pady = 5, expand = True, fill = BOTH)


Style: Label(bg = "lightblue")    
Style: LabelFrame(bg = "gold")

Frame: frame1 (bg = "white") {1}      
    LabelFrame: lf1 (text = "Header") {2}    
        Label: label1 (text = "My..first..GUI")     
        Button: button1 (text = "Thi..i..a..Button")  
        Entry: entry1 (bg = "white")        
    LabelFrame: lf2 (text = "Footer")    
        Label: label2 (text = "Footer")
        ttk.Combobox: cb1 ()

> cb1.set("Selection")

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for simpleTk, version 0.3.1
Filename, size File type Python version Upload date Hashes
Filename, size simpleTk-0.3.1-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size simpleTk-0.3.1.tar.gz (3.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page