PySImpleGUIで作った時計
準備
code:準備.sh
sudo apt install python3-tk
pip install pysimplegui
code:main.py
import PySimpleGUI as sg
import datetime
sg.theme("Black")
def getTime():
return datetime.datetime.now().strftime('%-m/%-d(%a)%H:%M:%S').replace("Sat", "土").replace("Sun", "日").replace("Mon", "月").replace("Tue", "火").replace("Wed", "水").replace("Thu", "木").replace("Fri", "金")
layout = sg.Text('', size=(19, 0), key='_time_')
window = sg.Window('Simple Clock', layout, location=(
1777, 1055), grab_anywhere=True)
while True:
event, values = window.Read(timeout=1000)
if event == sg.WINDOW_CLOSED:
break
window.FindElement('_time_').Update(getTime())
window.Close()
code:sh
https://i.imgur.com/K8cERdO.png
フルHDディスプレイで右下に表示されるよう、サイズと位置を決め打ちにしている