mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
added draw_rounded_rect_with_border_vertical_split() function to DrawEngine
This commit is contained in:
30
test/manual_integration_tests/test_combobox.py
Normal file
30
test/manual_integration_tests/test_combobox.py
Normal file
@ -0,0 +1,30 @@
|
||||
from tkinter import *
|
||||
|
||||
ws = Tk()
|
||||
ws.title('PythonGuides')
|
||||
ws.geometry('400x300')
|
||||
ws.config(bg='#F2B90C')
|
||||
|
||||
def display_selected(choice):
|
||||
choice = variable.get()
|
||||
print(choice)
|
||||
|
||||
countries = ['Bahamas','Canada', 'Cuba','United States']
|
||||
|
||||
# setting variable for Integers
|
||||
variable = StringVar()
|
||||
variable.set(countries[3])
|
||||
|
||||
# creating widget
|
||||
dropdown = OptionMenu(
|
||||
ws,
|
||||
variable,
|
||||
*countries,
|
||||
command=display_selected
|
||||
)
|
||||
|
||||
# positioning widget
|
||||
dropdown.pack(expand=True)
|
||||
|
||||
# infinite loop
|
||||
ws.mainloop()
|
@ -12,6 +12,7 @@ class CTkMenu(tkinter.Toplevel):
|
||||
self.config(bg='systemTransparent') # transparent bg
|
||||
self.geometry(f"120x{len(options) * (25 + 3) + 3}+{x}+{y}")
|
||||
self.bind("<FocusOut>", self.focus_loss_event)
|
||||
self.focus_force()
|
||||
|
||||
self.frame = customtkinter.CTkFrame(self, border_width=0, width=120, corner_radius=6, border_color="gray4", fg_color="#333740")
|
||||
self.frame.grid(row=0, column=0, sticky="nsew", rowspan=len(options) + 1, columnspan=1, ipadx=0, ipady=0)
|
||||
@ -44,7 +45,7 @@ app.geometry("600x500")
|
||||
|
||||
def open_menu():
|
||||
menu = CTkMenu(app, button.winfo_rootx(), button.winfo_rooty() + button.winfo_height() + 4, ["Option 1", "Option 2", "Point 3"])
|
||||
print(menu)
|
||||
|
||||
|
||||
button = customtkinter.CTkButton(command=open_menu, height=30, corner_radius=6)
|
||||
button.pack(pady=20)
|
||||
|
Reference in New Issue
Block a user