Skip to content

Instantly share code, notes, and snippets.

@horstjens
Created July 30, 2024 07:29
Show Gist options
  • Save horstjens/3a1d69192ee75e3d754427da47a216c1 to your computer and use it in GitHub Desktop.
Save horstjens/3a1d69192ee75e3d754427da47a216c1 to your computer and use it in GitHub Desktop.
freesimplegui_layout
import FreeSimpleGUI as sg
import FreeSimpleGUI as sg
# Define the window's contents
c_left = sg.Column(layout=[
[sg.Text("erste Zeile links1")],
[sg.Text("beginn links2")],
[sg.Text("links3")],
])
c_mitte = sg.Column(layout=[
[sg.Push(), sg.Text("erste Mitte"), sg.Push(),],
[sg.Push(), sg.Text("zweite Mitte"), sg.Push(),],
[sg.Push(),sg.Text("dritte Linie Mitte"),sg.Push(),],
])
c_rechts = sg.Column(layout=[
[sg.Push(), sg.Text("Ende erste Zeile")],
[sg.Push(), sg.Text("2.Zeile aus")],
[sg.Push(), sg.Text("Ende 3")],
])
layout = [[c_left, c_mitte, c_rechts],
#[sg.Text("What's your name?"), sg.Push(), sg.Text("mitte",justification="center"), sg.Push(), sg.Text("rechts")],
#[sg.Text("links widget"), sg.Push(), sg.Text("mitte widget",justification="center"), sg.Push(), sg.Text("rechts widget")],
[sg.Input(key='-INPUT-')],
[sg.Text(size=(40,1), key='-OUTPUT-')],
[sg.Button('Ok'), sg.Button('Quit')]]
# Create the window
window = sg.Window('Window Title', layout)
# Display and interact with the Window using an Event Loop
while True:
event, values = window.read()
# See if user wants to quit or window was closed
if event == sg.WINDOW_CLOSED or event == 'Quit':
break
# Output a message to the window
window['-OUTPUT-'].update('Hello ' + values['-INPUT-'] + "! Thanks for trying FreeSimpleGUI")
# Finish up by removing from the screen
window.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment