Created
December 16, 2018 04:38
-
-
Save MikeTheWatchGuy/b66f80caf94acc6351308f60d54571a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PySimpleGUI as sg | |
layout = [ [sg.Text('Drawing on a 400x400 Grid')], | |
[sg.Graph((400,400), (0,0), (400,400), key='GRAPH')], | |
[sg.Button('Go')] | |
] | |
window = sg.Window('My new window').Layout(layout) | |
graph = window.Element('GRAPH') | |
while True: # Event Loop | |
event, values = window.Read() | |
if event is None: | |
break | |
for i in range(1,10): | |
top_left = (i*25, i*25) | |
bot_right = (i*25+20, i*25-20) | |
graph.DrawRectangle(top_left, bot_right, fill_color='red', line_color='red') |
Author
MikeTheWatchGuy
commented
Dec 16, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment