j4321 / tkcalendar

Calendar widget for Tkinter
https://pypi.python.org/pypi/tkcalendar
GNU General Public License v3.0
98 stars 33 forks source link

Problem with ttk.Treeview and calendar #9

Closed Ivan88k closed 6 years ago

Ivan88k commented 6 years ago

Hi,

First thank you for sharing your code. tkcalendar works very well on its own but I have encountered an issue when using it with ttk.Treeview widget. Hope you can point me in the wright direction on what is causing window to expand by its self when adding DateEntry widget. Any help would be much appreciated.

I’m using Python 2.7.

Here is short version of my code to clarify error:

from Tkinter import *
import tkMessageBox
import ttk
from tkcalendar import DateEntry

naslovi = ("Rd_br", "Naziv_usluge")

proz = Tk()
proz_baze = Frame(proz, bg = "red")
proz_baze.pack(fill="both", expand=True)
proz_baze_gumb = Frame(proz, bg = "green")
proz_baze_gumb.pack(fill="both", expand=False)
tabli = ttk.Treeview(proz_baze, columns=naslovi, show="headings")
tabli.heading("Rd_br", text="Rd br:")
tabli.column("Rd_br", width=40)
tabli.heading("Naziv_usluge", text="Naziv usluge:")
tabli.column("Naziv_usluge", width=720 / 5 - 10)
tabli.grid(column=0, row=0, in_=proz_baze, pady=5, padx=5)
napomenaPonuda = Label(proz_baze_gumb, text="Ponuda vrijedi do:")
napomenaPonuda.grid(row=1, sticky=W)

proz_baze_gumb.grab_set()
napomenaPonudaUnos = DateEntry(proz_baze_gumb, background='darkblue', foreground='white', borderwidth=2) 
napomenaPonudaUnos.grid(row=1, column=1)

proz.mainloop()
j4321 commented 6 years ago

I have tried your code but I don't understand the issue you have. The window becomes a bit larger when you add the DateEntry because the default width of the DateEntry is too large for it to fit in the original window. If you want a smaller DateEntry, you can use the option width=.

Please try to give me more details about what you want to do, maybe a schematic of how you would like to position your widgets.

Ivan88k commented 6 years ago

Hmm, I made a small gif to show you what the error I am getting is. The window that is created is getting bigger and bigger… I can assume you don’t have that error? As I said I am using Python 2.7 on Windows 10.

20180331_220617_1

j4321 commented 6 years ago

Ok, I understand what you mean but, I am using Linux right now and I do not get this error, I will try later on Windows to see if this comes from the OS.

j4321 commented 6 years ago

I think I have solved the problem, please update tkcalendar to v1.1.5 and tell me if you still have the issue.

Ivan88k commented 6 years ago

Updated... Works like a charm.

Thank you for your effort.

aasadi1978 commented 5 years ago

I am using Python 3.6 with tkCalendar 1.4.0 and still having the same issue!

bcb2020 commented 2 years ago

I'm too, someone knows how does it fix?

Axorimaster commented 1 year ago

Hi! I'm using tkcalendar 1.6.1 and python 3.10 and getting same issue.

Su13n commented 1 year ago

Same issue using tkcalendar 1.6.1 on python 3.11. Edit: fixed by removing style