Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treeview with fixed column widths has extra space on right. #20

Open
noahblumADS opened this issue Nov 17, 2021 · 1 comment
Open

Treeview with fixed column widths has extra space on right. #20

noahblumADS opened this issue Nov 17, 2021 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@noahblumADS
Copy link

I've encountered a strange issue while using your theme. I use the ttk Treeview widget as a Listbox replacement (as the Listbox does not exist in ttk) for a program I write. However, when modifying my Treeview widget to have fixed width columns, there is always an extra space on the right of the last column.

This only happens while Azure is in use, and does not happen with the default themes.

While yes, the space does disappear when stretch=True for any of the columns, I do not want my columns to stretch (due to another weird unrelated issue where Treeview columns will expand infinitely when a specific widget is rendered in another window... yeah I know).

I have included a very short code snippet that reproduces my error, and have included screenshots showing my issue.

About my PC

I am running Windows 10 with Python 3.9.9
I am using Azure version 2.0 - png based branch

If there is anything else I can do or any other information I can provide, please let me know!

I have tried many things to remove this extra space, but I'm honestly not sure what is causing it. There is always the possibility that I am wrong, and this is not an issue with your theme, in which case I would be more than happy to be pointed in the right direction.

Code

import tkinter
from tkinter.ttk import Treeview, Style

root = tkinter.Tk()

# Comment out both for default theme
# Uncomment for Azure Theme
root.tk.call('source', ".\\script\\themes\\azure.tcl")    # Obviously would need to point to theme files
root.tk.call("set_theme", "light")    # Switch to dark for same result

# Uncomment for clam theme
# root.style = Style()
# root.style.theme_use("clam")

tv = Treeview(root, columns=('1', '2', '3'))
tv.pack(padx=20, pady=20)

tv.heading('1', text="Column 1")
tv.heading('2', text="Column 2")
tv.heading('3', text='Column 3')

tv.column('#0', minwidth=0, width=0, stretch=False)
tv.column("1", minwidth=350, width=350, stretch=False)
tv.column("2", minwidth=150, width=150, stretch=False)
tv.column("3", minwidth=75, width=75, stretch=False)

root.mainloop()

With default theme

image

With clam theme

image

With Azure Theme

image
image

@rdbende
Copy link
Owner

rdbende commented May 30, 2022

Ohh, hi! Sorry for the late reply. Actually I looked into this issue several times, but I couldn't find where the problem is. 😕

@rdbende rdbende added bug Something isn't working help wanted Extra attention is needed bad design The design is ugly or something is barely visible labels Jun 27, 2022
@rdbende rdbende removed the bad design The design is ugly or something is barely visible label Jul 14, 2022
@rdbende rdbende pinned this issue Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants