Skip to content

Instantly share code, notes, and snippets.

View MikeTheWatchGuy's full-sized avatar
♥️
Love making NEW things, not copying others... try it, it's much more fun!

MikeTheWatchGuy MikeTheWatchGuy

♥️
Love making NEW things, not copying others... try it, it's much more fun!
View GitHub Profile
import PySimpleGUI as sg
import os
import chess
import chess.pgn
import copy
import time
button_names = ('close', 'cookbook', 'cpu', 'github', 'pysimplegui', 'run', 'storage', 'timer')
CHESS_PATH = '.' # path to the chess pieces
import PySimpleGUI as sg
import random
# The callback functions
def answer_correct():
print('answer is correct')
words = [('1', 'one'), ('2', 'two'), ('3', 'three'), ('4', 'four'), ('5', 'five'), ('6', 'six')]
answer_1 = words[0][1]
answer_2 = words[1][1]
#!/usr/bin/env python
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
import cv2 as cv
from PIL import Image
import io
from sys import exit as exit
@MikeTheWatchGuy
MikeTheWatchGuy / Demo_psutil_Kill_Processes.py
Last active November 5, 2018 15:14
Process Killer using psutil and PySimpleGUI
#!/usr/bin/env python
import sys
import sys
if sys.version_info[0] >= 3:
import PySimpleGUI as sg
else:
import PySimpleGUI27 as sg
import os
import signal
import psutil
@MikeTheWatchGuy
MikeTheWatchGuy / output_from_input.py
Created October 6, 2018 00:05
Example of how to read input and show it in an another input box
import PySimpleGUI as sg
# The Window layout definition
# Pay close attention to the two Input Elements, they each have a key identifier
layout = [ [sg.Text('Test Program For StackOverflow') ],
[sg.T('Enter stuff here'), sg.Input(key='_in_')],
[sg.T('and it will show up here'), sg.Input(key='_out_')],
[ sg.Button('OK')] ]
# Make a window
@MikeTheWatchGuy
MikeTheWatchGuy / button_test.py
Created September 18, 2018 18:02
Reddit problem posted by hackintoshguy
import PySimpleGUI as sg
layout = [[sg.Text('1'), sg.Input(key='input1', do_not_clear=True),
sg.ReadFormButton('Button Set 1', key='Button Set 1'), sg.ReadFormButton('Button Read 1', key='Button Read 1')],
[sg.Text('2'), sg.Input(key='input2', do_not_clear=True),
sg.ReadFormButton('Button Set 2', key='Button Set 2'), sg.ReadFormButton('Button Read 2', key='Button Read 2')],
[sg.Text('3'), sg.Input(key='input3', do_not_clear=True),
sg.ReadFormButton('Button Set 3', key='Button Set 3'), sg.ReadFormButton('Button Read 3', key='Button Read 3')]]
form = sg.FlexForm('Example from Reddit', default_element_size=(10,1), grab_anywhere=False)
@MikeTheWatchGuy
MikeTheWatchGuy / gist:2ba11b1ef55e559e365b8ae862be1eff
Last active January 15, 2025 22:22
Sample Launcher GUI for StackOverlow
import PySimpleGUI as sg
sg.SetOptions(button_color=sg.COLOR_SYSTEM_DEFAULT)
frame = [[sg.Radio('This ARG', group_id=1)],
[sg.Radio('That ARG', group_id=1)],
[sg.Radio('Both ARG', group_id=1)]]
col2 = [[sg.SimpleButton('Clear')],
[sg.SimpleButton('Go!')]]
@MikeTheWatchGuy
MikeTheWatchGuy / scrframe.py
Created September 17, 2018 20:21
TKinter scrollable frame
#!/usr/bin/python
# -*- coding: utf-8 -*-
from Tkinter import * # from x import * is bad practice
from ttk import *
# http://tkinter.unpythonic.net/wiki/VerticalScrolledFrame
class VerticalScrolledFrame(Frame):
"""A pure Tkinter scrollable frame that actually works!
* Use the 'interior' attribute to place widgets inside the scrollable frame
import hashlib
# ------------------------ Hash code generator ------------------------
# use this code to generate your hashcode based on your password
# then paste the hash code into the variable secret_password_hash
# in the program you wish to password protect, copy and paste the lower 1/2 of this program.
password = input('Enter password to create hash: ')
try:
password_utf = password.encode('utf-8')
@MikeTheWatchGuy
MikeTheWatchGuy / ConvPathOnClipboard.py
Created December 10, 2017 17:29
Changes the #Windows clipboard contents into a 'paste-able' string by adding \ and \t etc.
#!/usr/bin/env python
#windows
import win32clipboard
'''
NO MORE manually adding \ into your Windows paths!!
python ConvPathOnClipboard.py
Windows program converts the text on the clipboard into a fully escaped and 'paste-able'