Python Forum
[Tkinter] Notebook + modules
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Notebook + modules
#1
Hi!

Is it possible to create your own module for every notebook(tab)? Then to import them. I want to make my code a bit better readable\manageable... (instead of one very long .py file)

So something like that:

nb_movies = ttk.Frame(nb)
nb.add(nb_movies, text='Movies')
import my_module_for_notebook_movies


import tkinter as tk
from tkinter import ttk

root = tk.Tk()
root.title("Monty Python Notebook Program")
root.geometry('500x300')
root.resizable = False

########## NOTEBOOK ##########
nb = ttk.Notebook(root)
nb.pack(fill='both')
nb_members = ttk.Frame(nb)
nb.add(nb_members, text='Python members')
nb_movies = ttk.Frame(nb)
nb.add(nb_movies, text='Movies')
nb_other_stuff = ttk.Frame(nb)
nb.add(nb_other_stuff, text='Other')
nb.enable_traversal()

########## MEMBERS NOTEBOOK ############
terry_lbl = ttk.Label(nb_members, text='Tery Gilliam')
terry_lbl.pack()

########## MOVIES NOTEBOOK ############
holy_lbl = ttk.Label(nb_movies, text='Monty Python and the Holy Grail')
holy_lbl.pack()

########## OTHER NOTEBOOK ############
quotes_lbl = ttk.Label(nb_other_stuff, text='Nobody expects the Spanish Inquisition')
quotes_lbl.pack()

root.mainloop()
So MOVIES/OTHER NOTEBOOK should be in another modul...
Reply


Messages In This Thread
Notebook + modules - by ifigazsi - Apr-06-2020, 08:48 AM
RE: Notebook + modules - by deanhystad - Apr-06-2020, 06:20 PM
RE: Notebook + modules - by ifigazsi - Apr-06-2020, 07:07 PM
RE: Notebook + modules - by deanhystad - Apr-06-2020, 07:41 PM
RE: Notebook + modules - by ifigazsi - Apr-08-2020, 09:15 AM
RE: Notebook + modules - by deanhystad - Apr-08-2020, 03:38 PM
RE: Notebook + modules - by ifigazsi - Apr-09-2020, 11:18 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020