commit
5fbf792123
|
@ -10,13 +10,20 @@ import datetime
|
||||||
import calendar
|
import calendar
|
||||||
import forecastio
|
import forecastio
|
||||||
|
|
||||||
NUM_COLS = 5
|
NUM_COLS = 5 # Changes number of days in forecast
|
||||||
|
MY_LOCATION_LAT = 35.738387
|
||||||
|
MY_LOCATION_LON = -79.203797
|
||||||
|
DARKSKY_KEY = "bb9b798d340e413869ea72ac1bea9742" # *** INSERT YOUR DARKSKY KEY HERE **
|
||||||
|
|
||||||
def led_clock():
|
def led_clock():
|
||||||
def update_weather():
|
def update_weather():
|
||||||
api_key = "bb9b798d340e413869ea72ac1bea9742" # *** INSERT YOUR DARKSKY KEY HERE **
|
"""
|
||||||
lat = 35.738387
|
Download weather data and then populates the GUI with results
|
||||||
lng = -79.203797
|
:return:
|
||||||
|
"""
|
||||||
|
api_key = DARKSKY_KEY
|
||||||
|
lat = MY_LOCATION_LAT
|
||||||
|
lng = MY_LOCATION_LON
|
||||||
forecast = forecastio.load_forecast(api_key, lat, lng)
|
forecast = forecastio.load_forecast(api_key, lat, lng)
|
||||||
daily = forecast.daily()
|
daily = forecast.daily()
|
||||||
max_temps = []
|
max_temps = []
|
||||||
|
@ -60,8 +67,8 @@ def led_clock():
|
||||||
layout = [[sg.Column(clock, background_color='black')],
|
layout = [[sg.Column(clock, background_color='black')],
|
||||||
[sg.Column(weather_cols[x], background_color='black') for x in range(NUM_COLS)],
|
[sg.Column(weather_cols[x], background_color='black') for x in range(NUM_COLS)],
|
||||||
|
|
||||||
[sg.RButton('Exit', button_color=('white', 'black'), image_data=orangeround[22:],
|
[sg.RButton('Exit', button_color=('black', 'black'),
|
||||||
tooltip='close window')]]
|
image_data=orangeround[22:], tooltip='close window', pad=((450,0),(10,0)))]]
|
||||||
window = sg.Window('My new window',
|
window = sg.Window('My new window',
|
||||||
background_color='black',
|
background_color='black',
|
||||||
grab_anywhere=True,
|
grab_anywhere=True,
|
||||||
|
|
|
@ -248,6 +248,7 @@ ELEM_TYPE_BLANK = 'blank'
|
||||||
ELEM_TYPE_TABLE = 'table'
|
ELEM_TYPE_TABLE = 'table'
|
||||||
ELEM_TYPE_TREE = 'tree'
|
ELEM_TYPE_TREE = 'tree'
|
||||||
ELEM_TYPE_ERROR = 'error'
|
ELEM_TYPE_ERROR = 'error'
|
||||||
|
ELEM_TYPE_SEPARATOR = 'separator'
|
||||||
|
|
||||||
# ------------------------- Popup Buttons Types ------------------------- #
|
# ------------------------- Popup Buttons Types ------------------------- #
|
||||||
POPUP_BUTTONS_YES_NO = 1
|
POPUP_BUTTONS_YES_NO = 1
|
||||||
|
@ -1139,8 +1140,7 @@ class Output(Element):
|
||||||
bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR
|
bg = background_color if background_color else DEFAULT_INPUT_ELEMENTS_COLOR
|
||||||
fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR
|
fg = text_color if text_color is not None else DEFAULT_INPUT_TEXT_COLOR
|
||||||
|
|
||||||
super().__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font,
|
super().__init__(ELEM_TYPE_OUTPUT, size=size, background_color=bg, text_color=fg, pad=pad, font=font, tooltip=tooltip, key=key)
|
||||||
tooltip=tooltip, key=key)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def TKOut(self):
|
def TKOut(self):
|
||||||
|
@ -1430,8 +1430,7 @@ class ProgressBar(Element):
|
||||||
# Image #
|
# Image #
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
class Image(Element):
|
class Image(Element):
|
||||||
def __init__(self, filename=None, data=None, background_color=None, size=(None, None), pad=None, key=None,
|
def __init__(self, filename=None, data=None, background_color=None, size=(None, None), pad=None, key=None, tooltip=None):
|
||||||
tooltip=None):
|
|
||||||
'''
|
'''
|
||||||
Image Element
|
Image Element
|
||||||
:param filename:
|
:param filename:
|
||||||
|
@ -1656,9 +1655,7 @@ class Graph(Element):
|
||||||
# Frame #
|
# Frame #
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
class Frame(Element):
|
class Frame(Element):
|
||||||
def __init__(self, title, layout, title_color=None, background_color=None, title_location=None,
|
def __init__(self, title, layout, title_color=None, background_color=None, title_location=None, relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, border_width=None, key=None, tooltip=None):
|
||||||
relief=DEFAULT_FRAME_RELIEF, size=(None, None), font=None, pad=None, border_width=None, key=None,
|
|
||||||
tooltip=None):
|
|
||||||
'''
|
'''
|
||||||
Frame Element
|
Frame Element
|
||||||
:param title:
|
:param title:
|
||||||
|
@ -1727,6 +1724,28 @@ class Frame(Element):
|
||||||
super().__del__()
|
super().__del__()
|
||||||
|
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------- #
|
||||||
|
# Separator #
|
||||||
|
# Routes stdout, stderr to a scrolled window #
|
||||||
|
# ---------------------------------------------------------------------- #
|
||||||
|
class VerticalSeparator(Element):
|
||||||
|
def __init__(self, pad=None):
|
||||||
|
'''
|
||||||
|
VerticalSeperator - A separator that spans only 1 row in a vertical fashion
|
||||||
|
:param pad:
|
||||||
|
'''
|
||||||
|
self.Orientation = 'vertical' # for now only vertical works
|
||||||
|
|
||||||
|
super().__init__(ELEM_TYPE_SEPARATOR, pad=pad)
|
||||||
|
|
||||||
|
|
||||||
|
def __del__(self):
|
||||||
|
super().__del__()
|
||||||
|
|
||||||
|
VSeperator = VerticalSeparator
|
||||||
|
VSep = VerticalSeparator
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
# Tab #
|
# Tab #
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
|
@ -1894,9 +1913,7 @@ class TabGroup(Element):
|
||||||
# Slider #
|
# Slider #
|
||||||
# ---------------------------------------------------------------------- #
|
# ---------------------------------------------------------------------- #
|
||||||
class Slider(Element):
|
class Slider(Element):
|
||||||
def __init__(self, range=(None, None), default_value=None, resolution=None, tick_interval=None, orientation=None,
|
def __init__(self, range=(None, None), default_value=None, resolution=None, tick_interval=None, orientation=None, border_width=None, relief=None, change_submits=False, disabled=False, size=(None, None), font=None, background_color=None, text_color=None, key=None, pad=None, tooltip=None):
|
||||||
border_width=None, relief=None, change_submits=False, disabled=False, size=(None, None), font=None,
|
|
||||||
background_color=None, text_color=None, key=None, pad=None, tooltip=None):
|
|
||||||
'''
|
'''
|
||||||
Slider Element
|
Slider Element
|
||||||
:param range:
|
:param range:
|
||||||
|
@ -2731,6 +2748,8 @@ class Window:
|
||||||
self.TKroot.quit() # kick the users out of the mainloop
|
self.TKroot.quit() # kick the users out of the mainloop
|
||||||
|
|
||||||
def Read(self, timeout=None, timeout_key='_timeout_'):
|
def Read(self, timeout=None, timeout_key='_timeout_'):
|
||||||
|
if timeout == 0:
|
||||||
|
return self.ReadNonBlocking()
|
||||||
self.Timeout = timeout
|
self.Timeout = timeout
|
||||||
self.TimeoutKey = timeout_key
|
self.TimeoutKey = timeout_key
|
||||||
self.NonBlocking = False
|
self.NonBlocking = False
|
||||||
|
@ -4223,8 +4242,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar,
|
tkscale = tk.Scale(tk_row_frame, orient=element.Orientation, variable=element.TKIntVar,
|
||||||
from_=range_from, to_=range_to, resolution=element.Resolution,
|
from_=range_from, to_=range_to, resolution=element.Resolution,
|
||||||
length=slider_length, width=slider_width, bd=element.BorderWidth,
|
length=slider_length, width=slider_width, bd=element.BorderWidth,
|
||||||
relief=element.Relief, font=font
|
relief=element.Relief, font=font, tickinterval=element.TickInterval)
|
||||||
, tickinterval=element.TickInterval)
|
|
||||||
tkscale.config(highlightthickness=0)
|
tkscale.config(highlightthickness=0)
|
||||||
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
if element.BackgroundColor is not None and element.BackgroundColor != COLOR_SYSTEM_DEFAULT:
|
||||||
tkscale.configure(background=element.BackgroundColor)
|
tkscale.configure(background=element.BackgroundColor)
|
||||||
|
@ -4366,6 +4384,10 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
|
||||||
if element.Tooltip is not None: # tooltip
|
if element.Tooltip is not None: # tooltip
|
||||||
element.TooltipObject = ToolTip(element.TKTreeview, text=element.Tooltip,
|
element.TooltipObject = ToolTip(element.TKTreeview, text=element.Tooltip,
|
||||||
timeout=DEFAULT_TOOLTIP_TIME)
|
timeout=DEFAULT_TOOLTIP_TIME)
|
||||||
|
# ------------------------- Separator element ------------------------- #
|
||||||
|
elif element_type == ELEM_TYPE_SEPARATOR:
|
||||||
|
separator = ttk.Separator(tk_row_frame, orient=element.Orientation, )
|
||||||
|
separator.pack(side=tk.LEFT, padx=element.Pad[0], pady=element.Pad[1], fill='both',expand=True )
|
||||||
|
|
||||||
# ............................DONE WITH ROW pack the row of widgets ..........................#
|
# ............................DONE WITH ROW pack the row of widgets ..........................#
|
||||||
# done with row, pack the row of widgets
|
# done with row, pack the row of widgets
|
||||||
|
|
2031
PySimpleGUI27.py
2031
PySimpleGUI27.py
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue