Tkinter Notebook part 1 – Pybook 1.0

Today we will start making an ebook maker from skratch. We made one type of ebook maker before, but now we want to make it from 0 again to make it a little different and maybe with less code. So… let’s start.

We will use Visual Studio Code, that it’s free and we will use also the kite plugin that helps to write the code faster.

import tkinter as tk

def create_listbox(f):
    return tk.Listbox(f).pack(fill=tk.Y, expand=1)
    
def create_label(f, t):
    return tk.Label(f, text=t).pack()

def create_text(f):
    return tk.Text(f).pack()

# ======== The window

root = tk.Tk()

# FRAME 1 ON THE LEFT
frame1 = tk.Frame(root)
frame1.pack(side="left", fill=tk.Y, expand=1)
lb1 = create_label(frame1, "Index of chapters")
lbx1 = create_listbox(frame1)
# FRAME 2
frame2 = tk.Frame(root)
frame2.pack(side="left")
lb2 = create_label(frame2, "Content of chapters")
lbx2 = create_text(frame2)

root.mainloop()

The live coding video of the Pybook app

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.