Akascape / py-window-styles

Customize your python UI window with awesome pre-built windows 11 themes.
Creative Commons Zero v1.0 Universal
257 stars 15 forks source link

Widgets dissappearing in ctkinter #28

Open shubhwins07 opened 1 month ago

shubhwins07 commented 1 month ago

Discussed in https://github.com/Akascape/py-window-styles/discussions/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- ![Screenshot 2024-05-13 190055](https://github.com/Akascape/py-window-styles/assets/131468983/f71164ec-32b9-403f-b04b-9eccc6dd92d7) **Snipping tool screenshot** ![image](https://github.com/Akascape/py-window-styles/assets/131468983/3c31ba71-2a99-4ac0-b7d2-0ed96f1efd19) **An image from OBS recording** ``` 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() ```
littlewhitecloud commented 1 month ago

I'm not getting this error on my computer when using OBS (version 30.0.2) image

Akascape commented 1 month ago

@littlewhitecloud I am also not getting any issue like this, using the latest OBS version. I also searched about this and found that it can be a permission issue of obs, or maybe the obs version is outdated.

image