cannot increase the size of combobox without it glitching out?
Here is an image of how the combo boxes are glitched:

I have used pretty average code but i am not using a grid just a normal x and y coordinates:
from tkinter import *
from tkinter.ttk import Progressbar
from tkinter.ttk import Combobox
from tkinter.ttk import Notebook
from tkinter.ttk import Treeview
from PIL import Image, ImageTk
import tkinter.font
import tkinter.messagebox
import customtkinter
class Widget1():
def __init__(self, parent):
self.gui(parent)
def gui(self, parent):
if parent == 0:
self.w1 = Tk()
self.w1.geometry('500x450')
else:
self.w1 = Frame(parent)
self.w1.place(x = 0, y = 0, width = 500, height = 450)
self.combo1 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 16), cursor = "arrow", state = "normal")
self.combo1.place(x = 180, y = 330, width = 250, height = 52)
self.combo2 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 16), cursor = "arrow", state = "normal")
self.combo2.place(x = 80, y = 260, width = 350, height = 62)
self.combo3 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 16), cursor = "arrow", state = "normal")
self.combo3.place(x = 170, y = 130, width = 110, height = 80)
self.combo4 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 12), cursor = "arrow", state = "normal")
self.combo4.place(x = 50, y = 50, width = 360, height = 40)
if __name__ == '__main__':
a = Widget1(0)
a.w1.mainloop()
Does anyone know how to resize a combo box?
You have to pass the width and height arguments to the constructor of the widget, not the place method. I have never seen that you can also pass them to the place method and I don't know why it behaves different then, but I will prevent this possibility in the next version.
And if i need to use relwidth in plase()? I use that way: for k, nxt in self.smb_compress_method.children.items(): if k == '!entry': val = nxt.grid_info() val['padx'] = (6, 100) nxt.grid(val)
@TomSchimansky I also experienced this problem with CTK v5.1.2 when using weights in a grid (and sticking to "NSEW" to fill the cell).
from customtkinter import CTk, CTkComboBox
from typing import Any
class Window(CTk):
"""
ComboBox issue showcase
"""
__test_combobox: CTkComboBox
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.geometry("500x200")
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
self.__test_combobox = CTkComboBox(self, values=["a", "b", "c"])
self.__test_combobox.grid(row=0, column=0, sticky="NSEW")
if __name__ == '__main__':
win = Window()
win.mainloop()

self.__test_combobox.grid(row=0, column=0, sticky="NSEW")
You're telling the widget to fill the whole window with this, you most likely just want to do.
self.__test_combobox.grid(row=0, column=0, sticky="EW")
if you really need to change the height of it pass it to the constructor of the widget.
self.__test_combobox = CTkComboBox(self, values=["a", "b", "c"], height=50)
@ElectricCandlelight Thanks for your answer. I already thought of this solution. But what if i want a dynamic height?
Out of curiosity why would you need it to be taller than standard height? I can't think of a situation were it would be beneficial for it to be taller than the standard height since it only displays one line of text.
I actually think it's possible to do it without it glitching out. Will post an example once I get a chance.
'class Widget1(): def init(self, parent): self.gui(parent)
def gui(self, parent):
if parent == 0:
self.w1 = Tk()
self.w1.geometry('500x450')
else:
self.w1 = Frame(parent)
self.w1.place(x = 0, y = 0, width = 500, height = 450)
self.combo1 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 16), cursor = "arrow", state = "normal", width = 250, height = 52)
self.combo1.place(x = 180, y = 330)
self.combo2 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 16), cursor = "arrow", state = "normal", width = 350, height = 62)
self.combo2.place(x = 80, y = 260)
self.combo3 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 16), cursor = "arrow", state = "normal", width = 110, height = 80)
self.combo3.place(x = 170, y = 130)
self.combo4 = customtkinter.CTkComboBox(self.w1, font = ("Helvetica Neue", 12), cursor = "arrow", state = "normal", width = 360, height = 40)
self.combo4.place(x = 50, y = 50)'
made some code changes added the height and width attributes in CTkcomboBox() instead for place()
how to limit the value of option menu?
Hiii, I have almost the same problem. I use the relwidth and relheight. And it does the same thing. Did anyone figure this out yet?