Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Widgets dissappearing in ctkinter #28

Open
shubhwins07 opened this issue May 19, 2024 Discussed in #27 · 2 comments
Open

Widgets dissappearing in ctkinter #28

shubhwins07 opened this issue May 19, 2024 Discussed in #27 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@shubhwins07
Copy link

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-

Screenshot 2024-05-13 190055
Snipping tool screenshot

image
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()
```</div>
@Akascape Akascape added the help wanted Extra attention is needed label May 19, 2024
@littlewhitecloud
Copy link
Contributor

littlewhitecloud commented May 19, 2024

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

@Akascape
Copy link
Owner

Akascape commented May 19, 2024

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants