-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
Discussed in #27
Originally posted by shubhwins07 May 13, 2024
In my customtkinter programs(all of them), when I try to implement pywinstyles, the app does get transparent but the widgets just disappear, I have tried .update() .after() but none of them work, when I capture the screen(both screenshot and recording using window's tools), then the widgets are somehow visible but when i capture screen with OBS studio it isn't visible as in normal use. Could you please help me? I have written the code below-
import customtkinter as ctk
import time
import pywinstyles
window = ctk.CTk()
window.title("My Clock App")
window.geometry("300x200")
pywinstyles.apply_style(window, "acrylic")
stopwatchRunning = False
total_time = 0.0
start_time = None
def printtime(label):
global total_time
global start_time
if stopwatchRunning:
if start_time is None:
# Stopwatch just started or resumed, record the current time
start_time = time.time()
else:
# Stopwatch is still running, update the total time and the label
currenttime = time.time()
elapsed = currenttime - start_time
total_time += elapsed
total_time=round(total_time, 2)
label.configure(text=f"{total_time:.2f} secs")
# Record the current time for the next update
start_time = currenttime
label.after(50, printtime, label)
def start_stopwatch():
global stopwatchRunning
if not stopwatchRunning:
stopwatchRunning = True
printtime(label)
def stop_stopwatch():
global stopwatchRunning
global start_time
stopwatchRunning = False
# Reset the start time so the next start will know it's a new start
start_time = None
def restart_stopwatch():
global total_time
global start_time
global stopwatchRunning
total_time = 0.0
start_time = None
stopwatchRunning = False
label.configure(text="0.00 secs")
label = ctk.CTkLabel(window, text="00:00.00 secs", font=("SF Pro Display", 24))
start_button = ctk.CTkButton(window, text="Start",command=start_stopwatch)
stop_button = ctk.CTkButton(window, text="Stop", command=stop_stopwatch)
restart = ctk.CTkButton(window, text="Restart",command=restart_stopwatch)
label.pack(pady=10)
start_button.pack(pady=5)
stop_button.pack(pady=5)
restart.pack(pady=5)
window.mainloop()
```</div>
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed

