Tkinter-Designer icon indicating copy to clipboard operation
Tkinter-Designer copied to clipboard

Is it possible to support tabs

Open ascitegong opened this issue 3 years ago • 1 comments

Many thanks for the fantastic project. Is it possible to support creating Tabs?

ascitegong avatar Jul 04 '22 06:07 ascitegong

Hello @ascitegong

I'm afraid this repo can not suppor tabs, but if you want to create tabs for TabPane (or NoteBook) you can easily insert them with the code generated using this tool.

Small example:

class Master(tk.Frame):

    def __init__(self, parent, controller, *args, **kwargs):
        tk.Frame.__init__(self, parent, background='#FFFFFF')

        self.controller = controller
        self.pageTwoFrames = []

        self.notebook = ttk.Notebook(self, *args, **kwargs)
        self.notebook.place(
            x=0.0,
            y=60.0,
            width=1024.0,
            height=660.0
        )

        self.canvas = Canvas(
            self,
            bg="#FFFFFF",
            height=55,
            width=1024,
            bd=0,
            highlightthickness=0,
            relief="ridge"
        )
        # You can call this function outside init of the class 
        self.addFrame(PaneForNotebook, 'Example - 0 ')

    def addFrame(self, frameType, name: str):
        self.aux = frameType(self.notebook, self.controller, self)
        self.pageTwoFrames.append(self.aux)
        self.notebook.add(self.aux, text=name, padding=5)
        self.notebook.place(
            x=0.0,
            y=60.0,
            width=1024.0,
            height=699.0
        )
        self.notebook.select(self.aux)



class PaneForNotebook(tk.Frame):

    def __init__(self, parent, controller, classParent):
        tk.Frame.__init__(self, parent)

        self.controller = controller
        self.parent = parent
        self.classParent = classParent

        self.canvas = Canvas(
            self,
            bg="#FFFFFF",
            height=650,
            width=1024,
            bd=0,
            highlightthickness=0,
            relief="ridge"
        )

class AnotherPaneForNotebook(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        # Your code below

Any extra help ask for it, HackingAll

HackingAllYT avatar Jul 12 '22 23:07 HackingAllYT

Thanks @HackingAllYT for the help. I'll close this issue @ascitegong

ParthJadhav avatar Nov 02 '22 04:11 ParthJadhav