akascape / py-window-styles Goto Github PK
View Code? Open in Web Editor NEWCustomize your python UI window with awesome pre-built windows 11 themes.
License: Creative Commons Zero v1.0 Universal
Customize your python UI window with awesome pre-built windows 11 themes.
License: Creative Commons Zero v1.0 Universal
when I set
root.resizable(width=False, height=False)
The style doesn't change. I'm using normal tkinter.
def ChangeDWMAccent(hWnd: int, attrib: int, state: int, color: str | None = None) -> None:
TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'
The | operator only supports python 3.10 and newer.
from typing import Union
def ChangeDWMAccent(hWnd: int, attrib: int, state: int, color: Union[str, None] = None) -> None:
System: Windows 10 22H2 19045.3448
GPU: NVIDIA GeForce RTX 3060
Python:3.11.5
Enabling the "Transparency Effects" option in Personalization > Colors leads to severe lag when using transparent themes (acrylic, aero, transparent). When dragging windows, there is a significant delay, with windows gradually moving to the mouse's position. Even after releasing the mouse, the windows continue to move until they reach the final release point. Additionally, the GPU usage of the Desktop Window Manager (dwm.exe) ranges from approximately 5% to 30%.
Disabling the "Transparency Effects" option doesn't result in a noticeable difference in GPU usage by the Desktop Window Manager (dwm.exe), but the lag issue disappears.
code:
import tkinter
import pywinstyles
root = tkinter.Tk()
pywinstyles.apply_style(root, "acrylic")
root.mainloop()
lib\site-packages\customtkinter\windows\widgets\core_widget_classes\ctk_base_class.py", line 111, in config
raise AttributeError("'config' is not implemented for CTk widgets. For consistency, always use 'configure' instead.")
AttributeError: 'config' is not implemented for CTk widgets. For consistency, always use 'configure' instead.
When I try to activate the theme change to aero for the ctk.frame object, I get this error.
This library looks just fine. If it could be used in my project it would be very good. The parts of the code I'm trying to integrate it through:
class App(ctk.CTk):
def init(self):
super().init()
root = ctk.CTk()
ctk.set_default_color_theme("green") # Themes: "blue" (standard), "green", "dark-blue"
ctk.set_appearance_mode("dark")
self.title("")
self.geometry(f"{520}x{235}")
#Creating Main Frame
self.main_frame = ctk.CTkFrame(self, width=510,height=290)
self.main_frame.grid(row=0, column=10,columnspan=10, rowspan=10, ipadx=5, ipady=0, padx=0, pady=0, sticky="nw")
self.main_frame.grid_rowconfigure(3, weight=1)
self.cancel_button = ctk.CTkButton(self.main_frame, text = "Change",font=("Arial", 15),command=self.change_style('aero'))
self.cancel_button.grid(row=5, column=5,columnspan=2, padx=5, pady=10, rowspan=1)
def change_style(self,e):
pywinstyles.apply_style(self.main_frame, e)
Windows 10 22H2 (19045.4529)
3.12.3
1.8
tkinter
When using the dark theme, the title bar of the window is not dark, but looks like this:
When the window has undergone some operations, such as losing focus and regaining focus, or zooming, the title bar of the window will display normally:
when I apply semi transparent themes like aero, transparent and acrylic, my widgets are no longer visible in customtkinter.
Hey, So I use canvas to my app for position and things like that. Now when I use PyWinStyles it wont work because of the canavs, How do I make it part of the canvas?
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>
not working with PySimpleGUI
I tried :
pywinstyles.apply_style(window.TKroot, 'mica')
and :
from ctypes import windll import pywinstyles hwnd = windll.user32.GetActiveWindow() pywinstyles.change_header_color(hwnd, color="blue")
import customtkinter
import os
from PIL import Image
import pywinstyles
class App(customtkinter.CTk):
def init(self):
super().init()
self.title("TASK V1")
self.iconbitmap(r"C:\Users\musta\Downloads\New folder\bot.ico")
self.grid_rowconfigure(1, weight=1)
self.columnconfigure(2, weight=1)
# create scrollable checkbox frame
self.scrollable_checkbox_frame = ScrollableCheckBoxFrame(master=self, width=200, command=self.checkbox_frame_event,
item_list=[f"item {i}" for i in range(15)])
self.scrollable_checkbox_frame.grid(row=1, column=0, padx=15, pady=15, sticky="ns")
#if name == "main":
app = App()
pywinstyles.apply_style(app, 'acrylic')
app.mainloop()
self.toplevel_window.focus()
not particularly the code but across all the gui's that were previously working with the acrylic window now only appear slightly grey
ever since my laptop updated to the latest windows 11 update
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.