Skip to content

Instantly share code, notes, and snippets.

View MikeTheWatchGuy's full-sized avatar
🎯
Focusing

MikeTheWatchGuy

🎯
Focusing
View GitHub Profile
import PySimpleGUI as sg
layout = [
[sg.Image(filename=r'C:\Python\PycharmProjects\GooeyGUI\Holiday-Inn-Scheduler-master\imagebad.png')],
# [sg.Image(filename=r'C:\Python\PycharmProjects\GooeyGUI\Holiday-Inn-Scheduler-master\holidayinnlogo good.png')],
[sg.Button('Exit')]
]
window = sg.Window('My new window', layout)
import PySimpleGUI as sg
layout = [[sg.Text('My Text Editor')],
[sg.Multiline(size=(100,20))],]
window = sg.Window('My Text Editor', layout)
while True: # Event Loop
event, values = window.Read()
if event is None:
@MikeTheWatchGuy
MikeTheWatchGuy / Picture Rotation.py
Created May 13, 2019 13:21
Displays images from a folder on a rotation basis
#!/usr/bin/env python
import PySimpleGUI as sg
import os
from sys import exit as exit
from PIL import Image
import io
# Helper func
def image_file_to_bytes(filename, size):
try:
@MikeTheWatchGuy
MikeTheWatchGuy / Commodore64.py
Last active March 31, 2019 20:55
Duplication of GUI presented on Reddit, just to see what it would be like to write.
import PySimpleGUI as sg
import subprocess
def slider(key, initial_value):
return [sg.Slider((1, 200), resolution=0, default_value=initial_value, orientation='h', size=(10,15),key=key)]
layout = [ [sg.Text('Pitch')], slider('pitch', 64),
[sg.Text('Speed')], slider('speed',72),
[sg.Text('Mouth')], slider('mouth',128),
[sg.Text('Throat')],slider('throat',128),
@MikeTheWatchGuy
MikeTheWatchGuy / RedditMultGame2.py
Last active March 25, 2019 15:14
Demonstrates using PySimpleGUI to create a "flash card" type of mult game
import PySimpleGUI as sg
from random import randint
NUM_GUESSES_ALLOWED = 3
layout = [ [sg.Text('Multiplication Game', text_color='blue')],
[sg.Text('', size=(20,1), font='Arial 20', key='_QUESTION_', text_color='red')],
[sg.Input(size=(4,1), enable_events=True, key='_ANSWER_'), sg.Text('', size=(24,1), text_color='red', key='_OUTPUT_')],
# [sg.Button('Answer', bind_return_key=True), sg.Button('Quit')],
[sg.Text('Change Difficulty Level')],
@MikeTheWatchGuy
MikeTheWatchGuy / MultiWindowNetworkSimulation.py
Last active March 6, 2021 10:19
Python program that demonstrates how to run many simultaneous Windows using PySimpleGUI. Works with PySimpleGUI, PySimpleGUIQt, but has a bug with PySimpleGUIWx.
import PySimpleGUI as sg
from random import randint as randint
from random import choice as choice
import time
import string
"""
PySimpleGUI simulation of a network communications monitoring and manipulation of network connections
10 lines of Network connections are shown
Can click on a button to bring up a detailed view for the connection
@MikeTheWatchGuy
MikeTheWatchGuy / PasswordManagerPort.py
Created January 29, 2019 20:55
"Port" of application from tkinter to PySimpleGUI.
import PySimpleGUI as sg
sg.SetOptions(margins=(0,0), button_color=('white', 'black'), border_width=0, font='Times 14 bold')
top = [[sg.Button('Main Menu', font='Times 14 bold'),
sg.Button('Account', font='Times 14 bold'),
sg.Text(' '*(40), background_color='black'),
sg.Button('_', font='Times 14 bold'),
sg.Button('X', font='Times 14 bold')],]
#!/usr/bin/env python
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
from random import randint
import PySimpleGUI as sg
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, FigureCanvasAgg
import PySimpleGUI as sg
NUM_ROWS = 20
NUM_COLS = 80
layout = [
*[[sg.T(f'{i:02} ',background_color='white', text_color = 'gray60'), sg.In(size=(NUM_COLS,1), do_not_clear=True, key=i)] for i in range(NUM_ROWS)],
[sg.Button('Exit')]
]
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
import math
SIZE_X = 200
SIZE_Y = 100
NUMBER_MARKER_FREQUENCY = 25