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

Bug #25

Closed TerseSmile10428 closed 2 months ago

TerseSmile10428 commented 2 months ago

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?

Akascape commented 2 months ago

@TerseSmile10428 GIve a minimal example

TerseSmile10428 commented 2 months ago

When I'm running the app, I see the normal tkinter app and then it "re-opened" to the canvas app. which there the pywinstyles doesn't work

Akascape commented 2 months ago

You have to use the pywinstyles command again in the new canvas app to apply the effect.

TerseSmile10428 commented 2 months ago

Could you give me an example of a code with canvas and it working? Thanks

Akascape commented 2 months ago

I don't know which part of pywinstyles are you mentioning, please be clear and show your code example, or some screenshot

TerseSmile10428 commented 2 months ago

Alright, This is my code:

from pathlib import Path from tkinter import Tk, Canvas, Entry, Button, PhotoImage import pywinstyles

OUTPUT_PATH = Path(file).parent ASSETS_PATH = OUTPUT_PATH / Path(r"C:\PycharmProjects\Test\build\assets")

def relative_to_assets(path: str) -> Path: return ASSETS_PATH / Path(path)

window = Tk()

window.geometry("400x400") window.configure(bg="#FFFFFF") window.title("t")

canvas = Canvas( window, bg="#f2f2f9", height=400, width=400, bd=0, highlightthickness=0, relief="ridge" )

canvas.place(x=0, y=0)

pywinstyles.change_header_color(window, color="#00524d")

I'm not sure if this good, Tell me if you need the full script. Thanks for helping

Akascape commented 2 months ago

@TerseSmile10428 So what's the problem in this code? If you make a new window or toplevel, you have to again use pywinstyles.change_header_color(window, color="#00524d"), (now the window will be the new window)

TerseSmile10428 commented 2 months ago

So place it twice?

TerseSmile10428 commented 2 months ago

Oh, It's working in a other script, I found the problem. Thanks for helping!

Akascape commented 2 months ago

@TerseSmile10428 Please tell what issue you are facing, because it is working fine on my system: image

TerseSmile10428 commented 2 months ago

It didn't work on mine for some reason but when I copied and paste it worked, Strange

TerseSmile10428 commented 2 months ago

Oh, Just found the problem. It's window.resizable(False, False)

Akascape commented 2 months ago

@TerseSmile10428 If you use window.resizable(False, False) after pywinstyles then the header color is reversed to white. Yes, it is a strange behavior in tkinter.