Nefritox
Nefritox

Reputation: 147

Remove minimise and maximise Button

I have problem in my Tkinter application.

The code is the following:

def help_stats(self):
    self.help_about = tkinter.Toplevel(relief=tkinter.GROOVE)
    self.help_about.title('Statistika')
    self.help_about.config(width="350", height="300")   
    self.help_about.resizable(width=tkinter.FALSE, height=tkinter.FALSE)
    self.help_about_label = tkinter.Label(self.help_about,
                                          text="Something")
    self.help_about_label.pack(side=tkinter.TOP, expand=1,
                               fill=tkinter.BOTH, padx=20, pady=10)

If I click on something in my menu, this function is called, and a new window is created. I need, from that created window, to delete minimise Button and only leave the closing button. Is that possible?

Upvotes: 1

Views: 4112

Answers (1)

Vinkal
Vinkal

Reputation: 2984

use attributes as shown below. It removes both minimize and maximize button. I have tested the code on Windows 8.

self.help_about.attributes("-toolwindow",1)

Modify your code as shown below:

def help_stats(self):
    self.help_about = tkinter.Toplevel(relief=tkinter.GROOVE)
    self.help_about.attributes("-toolwindow",1)
    self.help_about.title('Statistika')
    self.help_about.config(width="350", height="300")   
    self.help_about.resizable(width=tkinter.FALSE, height=tkinter.FALSE)
    self.help_about_label = tkinter.Label(self.help_about, text="Something")
    self.help_about_label.pack(side=tkinter.TOP, expand=1, fill=tkinter.BOTH, padx=20, pady=10)

Upvotes: 1

Related Questions