PySimpleGUI / PySimpleGUI

Python GUIs for Humans! PySimpleGUI is the top-rated Python application development environment. Launched in 2018 and actively developed, maintained, and supported in 2024. Transforms tkinter, Qt, WxPython, and Remi into a simple, intuitive, and fun experience for both hobbyists and expert users.
https://www.PySimpleGUI.com
Other
13.36k stars 1.84k forks source link

Screen shots (Not to be used by users... these are a scratchpad) #1

Closed MikeTheWatchGuy closed 3 years ago

MikeTheWatchGuy commented 6 years ago

Learned this trick for hosting screen shots within GitHub msgbox gettextbox snap0102 snap0103 snap0104 snap0105

https://app.leanboard.io/board/3efa539b-3c23-4ddb-98a6-b2cd4558565c

MikeTheWatchGuy commented 6 years ago

all widgets on one screen

simple msgbox variablearguments custombuttoncolor msgboxok msgbox error msgbox autoclose msgboxyesno msgboxcancel msgboxokcancel

getfolderbox scrolledtextbox sha hash

getfilebox gettextbox

all widgets results

MikeTheWatchGuy commented 6 years ago

textelem multiline text

MikeTheWatchGuy commented 6 years ago

progress meter 2 progress meter 3 progress meter 4 progress meter 5 output element

happyconcepts commented 6 years ago

Looks very nice! If I wanted less bevel on the borders, could I change it without css?

MikeTheWatchGuy commented 6 years ago

You can control the "depth" of the Elements by using the BorderDepth option when creating the form. I don't have an option to control it only on the buttons; so I can't do it just to the buttons.

For narrower looking bevels,use something like this: with g.FlexForm('Everything bagel', AutoSizeText=True, DefaultElementSize=(40,1), BorderDepth=3) as form: It produces a form that looks like this: snap0076

happyconcepts commented 6 years ago

Very bagel. Can't wait to try it next week. Thanks!

MikeTheWatchGuy commented 6 years ago

snap0106 snap0113

MikeTheWatchGuy commented 6 years ago

This is by FAR the easiest way to share images on the net! Wow, super-easy drag and drop. machine learning example

MikeTheWatchGuy commented 6 years ago

debug print

MikeTheWatchGuy commented 6 years ago

sliders 2

listbox

MikeTheWatchGuy commented 6 years ago

logo01 2

MikeTheWatchGuy commented 6 years ago

everything example results 2

MikeTheWatchGuy commented 6 years ago

midi player interface

MikeTheWatchGuy commented 6 years ago

snap0125 snap0129 snap0130

MikeTheWatchGuy commented 6 years ago

media file player

MikeTheWatchGuy commented 6 years ago

media file player

MikeTheWatchGuy commented 6 years ago

snap0134 snap0136

snap0147

MikeTheWatchGuy commented 6 years ago

pysimplegui_logo

MikeTheWatchGuy commented 6 years ago

snap0138 image image

MikeTheWatchGuy commented 6 years ago

snap0146 snap0145 snap0143 snap0142

MikeTheWatchGuy commented 6 years ago

snap0148 snap0149

MikeTheWatchGuy commented 6 years ago

snap0151 snap0153

MikeTheWatchGuy commented 6 years ago

snap0155 snap0156

MikeTheWatchGuy commented 6 years ago

raspberry pi

MikeTheWatchGuy commented 6 years ago

Same form with system default and 3 different look and feels.

snap0096 snap0119 snap0117 snap0099 everything in green media player launcher 2

MikeTheWatchGuy commented 6 years ago

snap0131

MikeTheWatchGuy commented 6 years ago

snap0132 snap0135

MikeTheWatchGuy commented 6 years ago

machine learning

MikeTheWatchGuy commented 6 years ago

snap0162

import PySimpleGUI as sg

form = sg.FlexForm('Simple data entry form')  # begin with a blank form

layout = [
          [sg.Text('Please enter your Name, Address, Phone')],
          [sg.Text('Name', size=(15, 1)), sg.InputText()],
          [sg.Text('Address', size=(15, 1)), sg.InputText()],
          [sg.Text('Phone', size=(15, 1)), sg.InputText()],
          [sg.Submit(), sg.Cancel()]
         ]

button, (name, address, phone) = form.LayoutAndRead(layout)
MikeTheWatchGuy commented 6 years ago

snap0178 snap0177 snap0179 snap0180 snap0182 snap0181

MikeTheWatchGuy commented 6 years ago

scrolledtextbox 2 autoclose error msgbox yesno cancel ok cancel 2 ok gettextbox 2 getfilebox 2 getpathbox preogress meter

MikeTheWatchGuy commented 6 years ago

comparison

MikeTheWatchGuy commented 6 years ago

pysimplegui codebox sim easyguicodebox

import easygui_qt as eq
import PySimpleGUI as sg
import easygui   as eg

def codebox(msg, title, text):
    return sg.FlexForm(title).LayoutAndRead([[sg.Multiline(size=(60,4), default_text=msg)],[ sg.Multiline(size=(60,14), default_text=text)], [sg.OK(), sg.Cancel()]])

eg.codebox('msg', 'title', 'test')
codebox('msg', 'title', 'test')
# SourceDestFolders()
eq.show_message('message', 'title')
MikeTheWatchGuy commented 6 years ago

snap0207

MikeTheWatchGuy commented 6 years ago

red text

MikeTheWatchGuy commented 6 years ago

border 6

MikeTheWatchGuy commented 6 years ago

youtube download

MikeTheWatchGuy commented 6 years ago

dl 2 dl 1

MikeTheWatchGuy commented 6 years ago

snap0216

import PySimpleGUI as g

layout =  [[g.Text('YouTube Download Link', auto_size_text=True)],
            [g.InputText()],
            [g.OK(), g.Cancel()]]

button, (youtube_link, ) = g.FlexForm('Enter YouTube Link').LayoutAndRead(layout)

# insert code here to determine what options to include based on data from the link
resolution_1080p, resolution_720p, resolution_360 = None, True, False

if youtube_link is not None:
    form = g.FlexForm('Download Example', auto_size_text=True)
    layout = [[g.Text('YouTube Download Link', auto_size_text=True)],
              [g.Text('Your link is:')],
              [g.Text(youtube_link)],
              [g.Text('')],
              [g.Text('Video dimensions')],
              [g.Checkbox('1080p', default=resolution_1080p),
               g.Checkbox('720p', default=resolution_720p),
               g.Checkbox('360', default=resolution_360)],
              [g.OK(), g.Cancel()]]

    button, (values) = form.LayoutAndRead(layout)

    g.MsgBox(button, values)
MikeTheWatchGuy commented 6 years ago

snap0217

import PySimpleGUI as g

form = g.FlexForm('Registration form', auto_size_text=True)

layout = [
           [g.Text('Registration Form', size=(20,1), font=('Helvitica', 20))],
           [g.Text('Full name', size=(15,1)), g.InputText()],
           [g.Text('Email', size=(15,1)), g.InputText()],
           [g.Text('Gender', size=(15,1)), g.Radio('Male', group_id=1), g.Radio('Female', group_id=1)],
           [g.Text('Country', size=(15,1)), g.Combo(values=('select your country', 'USA', 'Other'))],
           [g.Text('Programming', size=(15,1)), g.Checkbox('Java'), g.Checkbox('Python')],
           [g.Submit(button_color=('white', 'red'))]
         ]

form.LayoutAndRead(layout)
MikeTheWatchGuy commented 6 years ago

snap0218

import PySimpleGUI as g

output1 = g.Text('')

layout = [
            [g.Text('What is your guess?')],
            [g.InputText()],
            [g.ReadFormButton('Submit')]
           ]

form = g.FlexForm('Number game')
form.Layout(layout)
number = 100

while True:
    button, (value,) = form.Read()
    guess = int(value)
    if guess == number:
        form.CloseNonBlockingForm()
        g.MsgBox('You Guessed Correctly!', 'Right')
        break
    if guess > number:
        output1.Update('Too high')
    elif guess < number:
        output1.Update('Too low')
MikeTheWatchGuy commented 6 years ago

launcher

import PySimpleGUI as sg
import os

def Launcher():

    form = sg.FlexForm('Script launcher')

    layout =  [
                [sg.Text('Script output....', size=(40, 1))],
                [sg.Output(size=(88, 20))],
                [sg.ReadFormButton('script1'), sg.ReadFormButton('script2'), sg.SimpleButton('EXIT')]
              ]

    form.Layout(layout)

    # ---===--- Loop taking in user input and using it to query HowDoI --- #
    while True:
        (button, value) = form.Read()
        if button == 'EXIT' or button is None:
            break           # exit button clicked
        if button == 'script1':
            ExecuteCommandOS('python SimScript.py')
        elif button == 'script2':
            ExecuteCommandOS('python SimScript.py')
        elif button == 'Enter':
            ExecuteCommandOS(value[0])      # send string without carriage return on end

def ExecuteCommandOS(command):
    output = os.popen(command).read()
    print(output)

if __name__ == '__main__':
    Launcher()
MikeTheWatchGuy commented 6 years ago

snap0227

import time
import PySimpleGUI as sg

def CubeTimer():
    # Show a form that's a running counter
    form = sg.FlexForm('Running Timer', auto_size_text=True)
    text_element = sg.Text('', size=(10, 2), font=('Helvetica', 20), justification='center')
    form_rows = [[sg.Text('Rubix Cube Timer')],
                 [text_element],
                 [sg.T(' ' * 15), sg.ReadFormButton('Start/Stop', focus=True), sg.Quit()]]
    form.LayoutAndRead(form_rows, non_blocking=True)

    # logic for reading the form buttons, starting/stopping timer
    timer_running = True
    i = 0
    while True:
        if timer_running:
            i += 1
        text_element.Update('{:02d}:{:02d}.{:02d}'.format((i//100)//60, (i//100)%60, i%100))
        button, values = form.ReadNonBlocking()
        if values is None or button == 'Quit':      # if user closed the window using X or clicked Quit button
            break
        elif button == 'Start/Stop':
            timer_running = not timer_running

        time.sleep(.01)
        # if the loop finished then need to close the form for the user
    form.CloseNonBlockingForm()
    del(form)

CubeTimer()
MikeTheWatchGuy commented 6 years ago

script launcher

MikeTheWatchGuy commented 6 years ago

These forms are in the "cookbook" document

compare 2 files super simple 2 simple file browse green everything non-blocking non-blocking 2 button callback 2

progress meter 6 tabbed form

MikeTheWatchGuy commented 6 years ago

5 line gui

MikeTheWatchGuy commented 6 years ago

progress meter 7

MikeTheWatchGuy commented 6 years ago

custom progress meter

MikeTheWatchGuy commented 6 years ago

robot control

MikeTheWatchGuy commented 6 years ago

gui0_1 gui1_1 gui2_1 gui3_1 gui4_1 gui5_1 gui6_1