a little bit optimized for me and pywinstyles #30
Open
MustafaHilmiYAVUZHAN wants to merge 4 commits intoAkascape:mainfrom
Open
a little bit optimized for me and pywinstyles #30MustafaHilmiYAVUZHAN wants to merge 4 commits intoAkascape:mainfrom
MustafaHilmiYAVUZHAN wants to merge 4 commits intoAkascape:mainfrom
Conversation
Author
|
this is a litlle update for title menu def __init__(
self,
master,
title_bar_color = "default",
padx: int = 10,
width: int = 10,
x_offset: int = None,
y_offset: int = None):
super().__init__()
if not platform.startswith("win"):
raise OSError("This title menu works only in windows platform, not supported on your system! \nTry the CTkMenuBar instead...")
#self.after(10)
self.master = master
if "zoomed" not in self.master.state():
not_zoomed=1
self.master.state("zoomed")
else:
not_zoomed=0
master_type = self.master.winfo_name()
if master_type=="tk":
pass
elif master_type.startswith("!ctktoplevel"):
pass
elif master_type.startswith("!toplevel"):
pass
else:
raise TypeError("Only root windows/toplevels can be passed as the master!")
self.master.minsize(200,100)
self.overrideredirect(True)
if title_bar_color=="default":
if customtkinter.get_appearance_mode()=="Light":
title_bar_color = 0xFFFFFF # RGB order: 0xrrggbb
else:
title_bar_color = 0x303030 # RGB order: 0xrrggbb
self.transparent_color = self._apply_appearance_mode(self._fg_color)
self.attributes("-transparentcolor", self.transparent_color)
self.resizable(True, True)
self.transient(self.master)
self.menu = []
self.config(background=self.transparent_color)
self.caption_color = title_bar_color
self.x_offset = 40 if x_offset is None else x_offset
self.y_offset = 6 if y_offset is None else y_offset
self.width = width
if x_offset is None:
title = self.master.title()
if len(title)>=1:
for i in title:
if i.islower():
self.x_offset += 9
else:
self.x_offset += 7
self.padding = padx
if not_zoomed:
self.master.state("normal")
self.master.bind("<Configure>", lambda _: self.change_dimension())
self.master.bind("<Destroy>", lambda _: super().destroy() if not self.master.winfo_viewable() else None)
self.num = 0
self.master.bind("<Map>", lambda e: self.withdraw) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There may be mistakes, I suggest you check before adding