israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.89k stars 381 forks source link

Added kwargs passthrough to tkinter.Tk on init of Window #558

Open dimsanius opened 6 months ago

dimsanius commented 6 months ago

Hello,

First of all, thanks for providing such a nice wrapper around basic tkinter application. This modules allows to achieve a really nice looking tkinter application as opposed to using bare tkinter app.

I have noticed that Window class usage is preffered as opposed to tkinter.Tk() when creating main/root window of an application. However, I have realised that Window class is missing some argument passthrough functionality - when Window's class super(in this case - tkinter.Tk()) class init method is called, there is no possibility to pass some arguments which are available according to an official tkinter documentation.

Hence, I have added missing functionality in.

Motivation behind it is following - I am using Ubuntu with GNOME environment. When creating a tkinter window using Window class, it creates an app which name defaults to Tk when I am hovering over the icon of the running app. In order to adjust it, I must change the value of className. However, there is no way of controlling it from Window class & I am not willing to revert back to "old" way of creating a window via calling tkinter.Tk() myself. Hence, I decided to make my contribution at this stage to lift the limitation of ttkbootstrap's Window class as this is where the limitation resides.

Current behaviour on Ubuntu using GNOME: image

Proposed change allows to change the pop-up text using className under Ubuntu GNOME: image

Below is the minimal code that I used to achieve the result displayed above:

import ttkbootstrap as ttk

class RootWindow(ttk.Window):

    def __init__(self):
        super().__init__(className="My awesome app")

app = RootWindow()
app.mainloop()