Akascape / CTkMenuBar

Modern menu/tool bar widget library for customtkinter. (extension/add-on)
Creative Commons Zero v1.0 Universal
104 stars 7 forks source link

problem using menubar with mater=frame #15

Closed Shak221 closed 5 months ago

Shak221 commented 6 months ago

hey, for example I brought the same code on website, but added a frame:

it said on site that the menubar can work with setting a master as a frame, but on this code the dropmenu doesnt work. i'd love to get some help

import customtkinter from CTkMenuBar import *

root = customtkinter.CTk() root.geometry("600x200")

Frame = customtkinter.CTkFrame(root) Frame.grid()

menu = CTkMenuBar(Frame) button_1 = menu.add_cascade("File") button_2 = menu.add_cascade("Edit") button_3 = menu.add_cascade("Settings") button_4 = menu.add_cascade("About")

dropdown1 = CustomDropdownMenu(widget=button_1) dropdown1.add_option(option="Open", command=lambda: print("Open")) dropdown1.add_option(option="Save")

dropdown1.add_separator()

sub_menu = dropdown1.add_submenu("Export As") sub_menu.add_option(option=".TXT") sub_menu.add_option(option=".PDF")

dropdown2 = CustomDropdownMenu(widget=button_2) dropdown2.add_option(option="Cut") dropdown2.add_option(option="Copy") dropdown2.add_option(option="Paste")

dropdown3 = CustomDropdownMenu(widget=button_3) dropdown3.add_option(option="Preferences") dropdown3.add_option(option="Update")

dropdown4 = CustomDropdownMenu(widget=button_4) dropdown4.add_option(option="Hello World")

root.mainloop()

Akascape commented 5 months ago

@Shak221 The menubar is still there but hidden inside the frame, better expand the whole frame

alnau commented 5 months ago

Won't this influence position of other widgets?

Akascape commented 5 months ago

@alnau So place the widgets in that frame. or overlap the widgets, the menu should automatically lift to the top.