New imports... switched order so that PyCharm will pick up with Python 3 import first
This commit is contained in:
parent
aeafdfeb19
commit
4548b1dd9b
84 changed files with 1071 additions and 265 deletions
|
@ -1,16 +1,20 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
if sys.version_info[0] < 3:
|
||||
import PySimpleGUI27 as sg
|
||||
else:
|
||||
if sys.version_info[0] >= 3:
|
||||
import PySimpleGUI as sg
|
||||
else:
|
||||
import PySimpleGUI27 as sg
|
||||
import math
|
||||
|
||||
|
||||
layout = [[sg.T('Example of Using Math with a Graph', justification='center', size=(40,1), relief=sg.RELIEF_RAISED)],
|
||||
[sg.Graph(canvas_size=(400, 400), graph_bottom_left=(-105,-105), graph_top_right=(105,105), background_color='white', key='graph', tooltip='This is a cool graph!')],]
|
||||
layout = [[sg.T('Example of Using Math with a Graph', justification='center',
|
||||
size=(50,1), relief=sg.RELIEF_SUNKEN)],
|
||||
[sg.Graph(canvas_size=(400, 400),
|
||||
graph_bottom_left=(-105,-105),
|
||||
graph_top_right=(105,105),
|
||||
background_color='white',
|
||||
key='graph')],]
|
||||
|
||||
window = sg.Window('Graph of Sine Function', grab_anywhere=True).Layout(layout).Finalize()
|
||||
|
||||
graph = window.FindElement('graph')
|
||||
|
||||
# Draw axis
|
||||
|
@ -27,6 +31,7 @@ for y in range(-100, 101, 20):
|
|||
if y != 0:
|
||||
graph.DrawText( y, (-10,y), color='blue')
|
||||
|
||||
|
||||
# Draw Graph
|
||||
for x in range(-100,100):
|
||||
y = math.sin(x/20)*50
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue