TomSchimansky / CustomTkinter

A modern and customizable python UI-library based on Tkinter
MIT License
11.52k stars 1.08k forks source link

Is there a way to hide segmented buttons which comes with CTkTabView? (Im beginner) #1593

Open Kurou-kun opened 1 year ago

Kurou-kun commented 1 year ago

I want to hide those buttons becouse i've made different one in different place to operate the CTkTabView. I couldn't find any info about it in documentation or issues.

This is my CTkTabView:

self.window.content.notebook = ct.CTkTabview(master=self.window.content, corner_radius=0, border_width=0)
self.window.content.notebook.pack(fill="both", expand=True)
TomSchimansky commented 1 year ago

Currently there is no option for this, but could be a good enhancement.

Kurou-kun commented 1 year ago

So if there is no option for it, is there any workaround to hide these buttons?

MaxNiark commented 1 year ago

u can get the button like this. try to do grid.froget()

=> self._tab_dict to get the CTKframe create by .add function.

When you click on button, call grid_forget() for button and frame about tabview with this var. this is dict var [STR, WIDGET]. and call your new frame with grid().


        self.test=CTkTabview(self)
        self.test.grid()

        self.add=self.test.add("test")
        print(self.test._segmented_button._buttons_dict)

image

TomSchimansky commented 1 year ago

@Kurou-kun you can do it like this, but this method can stop working with any new update:

tabview._top_spacing = 0
tabview._top_button_overhang = 0
tabview._segmented_button.grid_forget()
tabview._configure_grid()
Kurou-kun commented 1 year ago

@TomSchimansky I tried to use what you showed but those navigation buttons are still there. Maybe it doesnt work becouse i use .pack() method?

My entire code for notebook: (these with xx_tab() are functions from another file in which is content of every tab)

#   Content
self.window.content = ct.CTkTabview(master=self.window, corner_radius=0, fg_color="grey15")
self.window.content._top_spacing = 0
self.window.content._top_button_overhang = 0
self.window.content._segmented_button.grid_forget()
self.window.content._configure_grid()
self.window.content.pack(fill="both", side="right", expand=True)
assistance_tab(self.window.content, color_accent)
visuals_tab(self.window.content, color_accent)
players_tab(self.window.content, color_accent)
vehicles_tab(self.window.content, color_accent)
miscellaneous_tab(self.window.content, color_accent)
settings_tab(self.window.content, color_accent)

Image: obraz

Mr-G254 commented 1 year ago

https://github.com/Mr-G254/Media-Player-Desktop-App --run the mediaplayer.py file and check the first page.