Closed TerseSmile10428 closed 2 months ago
@TerseSmile10428 GIve a minimal example
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
You have to use the pywinstyles command again in the new canvas app to apply the effect.
Could you give me an example of a code with canvas and it working? Thanks
I don't know which part of pywinstyles are you mentioning, please be clear and show your code example, or some screenshot
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
@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)
So place it twice?
Oh, It's working in a other script, I found the problem. Thanks for helping!
@TerseSmile10428 Please tell what issue you are facing, because it is working fine on my system:
It didn't work on mine for some reason but when I copied and paste it worked, Strange
Oh, Just found the problem. It's window.resizable(False, False)
@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.
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?