Major update of all demo programs to use new PEP8 bindings, etc
This commit is contained in:
parent
3f7c87c562
commit
7f52778bcc
307 changed files with 19546 additions and 3297 deletions
|
@ -1,6 +1,24 @@
|
|||
import PySimpleGUI as sg
|
||||
import random
|
||||
|
||||
# Bars drawing in PySimpleGUI
|
||||
#
|
||||
# .--.
|
||||
# | |
|
||||
# .--.| |.--.
|
||||
# | || || |
|
||||
# | || || |
|
||||
# | || || |
|
||||
# .--.| || || |
|
||||
# .--.| || || || |.--.
|
||||
# | || || || || || |
|
||||
# | || || || || || |
|
||||
# .--.| || || || || || |.--.
|
||||
# | || || || || || || || |.--.
|
||||
# | || || || || || || || || |
|
||||
# '--''--''--''--''--''--''--''--''--'
|
||||
|
||||
|
||||
BAR_WIDTH = 50
|
||||
BAR_SPACING = 75
|
||||
EDGE_OFFSET = 3
|
||||
|
@ -9,21 +27,25 @@ DATA_SIZE = (500,500)
|
|||
|
||||
graph = sg.Graph(GRAPH_SIZE, (0,0), DATA_SIZE)
|
||||
|
||||
layout = [[sg.Text('Bar graphs using PySimpleGUI')],
|
||||
layout = [[sg.Text('Labelled Bar graphs using PySimpleGUI')],
|
||||
[graph],
|
||||
[sg.Button('OK')]]
|
||||
[sg.Button('OK'), sg.T('Click to display more data'), sg.Exit()]]
|
||||
|
||||
window = sg.Window('Window Title', layout)
|
||||
|
||||
while True:
|
||||
event, values = window.Read()
|
||||
graph.Erase()
|
||||
if event is None:
|
||||
event, values = window.read()
|
||||
if event in (None, 'Exit'):
|
||||
break
|
||||
|
||||
graph.erase()
|
||||
for i in range(7):
|
||||
graph_value = random.randint(0, 400)
|
||||
graph.DrawRectangle(top_left=(i * BAR_SPACING + EDGE_OFFSET, graph_value),
|
||||
graph.draw_rectangle(top_left=(i * BAR_SPACING + EDGE_OFFSET, graph_value),
|
||||
bottom_right=(i * BAR_SPACING + EDGE_OFFSET + BAR_WIDTH, 0), fill_color='blue')
|
||||
graph.DrawText(text=graph_value, location=(i*BAR_SPACING+EDGE_OFFSET+25, graph_value+10))
|
||||
window.Close()
|
||||
graph.draw_text(text=graph_value, location=(i*BAR_SPACING+EDGE_OFFSET+25, graph_value+10))
|
||||
window.close()
|
||||
# del window
|
||||
|
||||
while True:
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue