snakeware

Python-based Linux distro for x86-64 and RPi
git clone git://squid-tech.com/snakeware.git
Log | Files | Refs | README

commit ceccc8643b750553d803abc18e50606b5dcfeff9
parent 0f0d1574abc06da723e63f78c1b1135922f87cfd
Author: Josh Moore <jxm5210@g.rit.edu>
Date:   Mon,  1 Jun 2020 19:05:23 -0400

Merge pull request #33 from callmepavo/master

clock now shows the current date
Diffstat:
Asnakewm/apps/tools/clock/README.md | 18++++++++++++++++++
Dsnakewm/apps/tools/clock/README.txt | 6------
Msnakewm/apps/tools/clock/__init__.py | 2+-
Msnakewm/apps/tools/clock/clock.py | 14++++++++------
4 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/snakewm/apps/tools/clock/README.md b/snakewm/apps/tools/clock/README.md @@ -0,0 +1,18 @@ +# SnakeClock +SnakeClock displays the current date and time in a small window. + +# Authors + +Clock by Abdur-Rahmaan Janhangeer + ++ github: https://github.com/Abdur-rahmaanJ + ++ mail: arj.python@gmail.com + ++ date: 30 May 2020 + +Date functionality added by pavo + ++ github: https://github.com/callmepavo/ + ++ date: 2 Jun 2020 diff --git a/snakewm/apps/tools/clock/README.txt b/snakewm/apps/tools/clock/README.txt @@ -1,5 +0,0 @@ -Clock by Abdur-Rahmaan Janhangeer - -github: https://github.com/Abdur-rahmaanJ -mail: arj.python@gmail.com -date: 30 May 2020- \ No newline at end of file diff --git a/snakewm/apps/tools/clock/__init__.py b/snakewm/apps/tools/clock/__init__.py @@ -2,7 +2,7 @@ from .clock import SnakeClock def load(manager, params): """ - Create and launch a new instance of SnakeCalc. + Create and launch a new instance of SnakeClock. """ # default position pos = (100, 100) diff --git a/snakewm/apps/tools/clock/clock.py b/snakewm/apps/tools/clock/clock.py @@ -1,13 +1,13 @@ import pygame import pygame_gui -import time +import datetime class SnakeClock(pygame_gui.elements.UIWindow): def __init__(self, pos, manager): super().__init__( - pygame.Rect(pos, (300, 100)), + pygame.Rect(pos, (195, 100)), manager=manager, window_display_title='clock', object_id='#clockterm', @@ -16,7 +16,7 @@ class SnakeClock(pygame_gui.elements.UIWindow): self.textbox = pygame_gui.elements.UITextBox( '', - relative_rect=pygame.Rect(0, 1, 268, 40), + relative_rect=pygame.Rect(0, 1, 163, 40), manager=manager, container=self, anchors={ @@ -34,9 +34,11 @@ class SnakeClock(pygame_gui.elements.UIWindow): def update(self, time_delta): super().update(time_delta) - - t = time.localtime() - current_time = time.strftime("%H:%M:%S", t) + + dt = datetime.datetime.now() + # %X formatted clock, %x formatted date + current_time = dt.strftime("%X %x") + self.set_text(current_time) def set_text(self, text):