ntk will solve your problem when you can't learn and implement, python tkinter to create desktop application in concern to good looking and os level implementation.
Notebook is multi window wrapper for ntk window, we can create a notebook and add tabs for getting multi window in tabs
ntk Notebook is extended version of tkinter ttk/tcl-tk base Notebook with more functionality and responsive grid system, to use this Notebook window we need to import first it from ntk by
from ntk import Notebook
and initialize it by calling it
window = Notebook(root)
This will create wrapper and basic style will be applied, you need to pass parameters described below to get your desired window size and style
available parameters are:
root
, # root is a master window to place this notebook into itclass_="TNotebook"
, # notebook class to inherit objectcursor="arrow"
, # cursor style for notebook windowheight=180
, # notebook heightwidth=350
, # notebook widthtakefocus=0
, # set notebook window can take focus or notpadding=0
, # padding in square windowbg="bg-light"
, # background color, default is bootstrap referenced lightbd=0
, # border widthfg="fg-dark"
, # foreground color, default is bootstrap referenced darklightcolor="fg-info
", # light color, default is bootstrap referenced inforow=0
, # grid row positioncolumn=0
, # grid column positionsticky="wn"
, # grid sticky positionrowspan=1
, # grid row span widthcolumnspan=1
, # grid column span widthpadx=1
, # grid padding left and rightpady=1
, # grid padding top and bottomstyle=False
, # notebook default style
an example of creating Notebook window:
from ntk import Tk, Notebook, PanedWindow
root = Tk(title='Example of ntk window')
notebook = Notebook(root)
root.mainloop()
Notebook wrapper has a method called add, which can be used for adding a tab in Notebook for doing this,
panedwindow = PanedWindow(notebook)
# create a panedwindow to add it into NoteBook
notebook.add(child=panedwindow, text='First tab')
we can pass other parameters to add method, and those are,
width=16
, # tab head title width/text widthimage=False
, # not supported yetcompound="left"
, # can be used for imageunderline=99
, # underline position for tab header textsticky="wn
", # sticky positionpadding=0
# padding
you can pass extra arguments and keyword arguments, and those will be passed to tkinter Notebook class.