I am trying to prepare a program to display data to users based on the Notebook widget. I can display a notebook; now I want to move the tabs from the top to the right side. Tk can do it, but the tkinter documentation is unclear and vague at best and not obvious at worst. To make matters worse, my research turned up several other GUI libraries for Python, each of which offers a Notebook widget. My questions boil down to:
- How to choose which GUI package to use?
- If tkinter is the choice, are there code constructs to modify the Layout parms?
- Apparently Python has a method to allow execution of arbitrary commands by tk. Is this a viable or even desirable approach?
Moving Tabs to the right side:
There is a tab position option for it:
import tkinter as tk
from tkinter import ttk
root = tk.Tk()
style = ttk.Style(root)
style.configure('lefttab.TNotebook', tabposition='en') # e = East, n = North (order matters, e.g. 'en' != 'ne')
notebook = ttk.Notebook(root, style='lefttab.TNotebook')
f1 = tk.Frame(notebook, bg='red', width=200, height=200)
f2 = tk.Frame(notebook, bg='blue', width=200, height=200)
notebook.add(f1, text='Frame 1')
notebook.add(f2, text='Frame 2')
Source: Python Tkinter side notebook tabs - Stack Overflow
To answer your questions:
- I’m not sure about other GUI packages, but Tkinter is for desktop applications, Kivy is for mobile development. Tkinter is more suited for beginners.
- Could you elaborate on your question? (what is parms?)
- Could you elaborate this too?
Hope this helps.