Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import time
- import tkinter as tk
- from tkinter import messagebox as mb
- import keyboard
- from threading import Thread
- import datetime
- DARK_SYSTEM_APPS = open("T:/TechOS/Virtual/Settings/DARK_SYSTEM_APPS.set", "r").read()
- ACCENT_COLOR = open("T:/TechOS/Virtual/Settings/ACCENT_COLOR.set", "r").read()
- def color_variant(hex_color, brightness_offset=1):
- """ takes a color like #87c95f and produces a lighter or darker variant """
- if len(hex_color) != 7:
- raise Exception("Passed %s into color_variant(), needs to be in #87c95f format." % hex_color)
- rgb_hex = [hex_color[x:x+2] for x in [1, 3, 5]]
- new_rgb_int = [int(hex_value, 16) + brightness_offset for hex_value in rgb_hex]
- new_rgb_int = [min([255, max([0, i])]) for i in new_rgb_int] # make sure new values are between 0 and 255
- # hex() produces "0x88", we want just "88"
- return "#" + "".join(["{:02x}".format(i) for i in new_rgb_int])
- BLACK_ACCENT_COLOR = color_variant(ACCENT_COLOR, -200)
- DIM_ACCENT_COLOR = color_variant(ACCENT_COLOR, -20)
- DARK_ACCENT_COLOR = color_variant(ACCENT_COLOR, -10)
- LIGHT_ACCENT_COLOR = color_variant(ACCENT_COLOR, 10)
- BRIGHT_ACCENT_COLOR = color_variant(ACCENT_COLOR, 20)
- WHITE_ACCENT_COLOR = color_variant(ACCENT_COLOR, 200)
- global_bg_color = "white"
- global_fg_color = "black"
- global_ac_bg_color = "lightgray"
- global_sp_bg_color = WHITE_ACCENT_COLOR
- if DARK_SYSTEM_APPS == "True":
- global_bg_color = "gray12"
- global_fg_color = "gray90"
- global_ac_bg_color = "gray20"
- global_sp_bg_color = BLACK_ACCENT_COLOR
- _root = frame4
- frame4.config(bg=global_bg_color, pady=20)
- time_label = tk.Label(_root, text="??:??:?? ??", bg=global_bg_color, fg=global_fg_color, font="TkDefaultFont 40", anchor='nw')
- time_label.pack(anchor='nw', padx=20)
- date_label = tk.Label(_root, text="Unknown Date", bg=global_bg_color, fg=ACCENT_COLOR, font="TkDefaultFont 15", anchor='nw')
- date_label.pack(anchor='nw', padx=25)
- def clock():
- time1 = datetime.datetime.now().strftime("%H:%M:%S/%p")
- time2, time3 = time1.split('/')
- hour, minutes, seconds = time2.split(':')
- if int(hour) > 12 and int(hour) < 24:
- time = str(int(hour) - 12) + ':' + minutes + ':' + seconds + ' ' + time3
- else:
- time = str(int(hour)) + ':' + minutes + ':' + seconds + ' ' + time3
- time_label.config(text=time)
- time_label.after(1000, clock)
- def date():
- date1 = datetime.datetime.now().strftime("%A, %B %d, %Y")
- date_label.config(text=date1)
- date_label.after(60000, date)
- Thread(target=clock, daemon=True).start()
- Thread(target=date, daemon=True).start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement