Python Forum
[Tkinter] Notebook + modules
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Notebook + modules
#4
What do you add to a notebook? Write modules to contain a function that makes one of those and returns it. To make it easy to remember I would use the same function name for each module. In the main program import the modules, call the functions, add the returned value to the notebook.
import 'memberspage', 'moviespage', ...

nb = ttk.Notebook(root)
...
nb.add(memberspage.page(nb), text=memberspage.title)
nb.add(moviespage.page(nb), text=moviespage.title)
...
If you wanted to get really clever you could put all your pages in a folder, Open the folder, read the names in, sort possibly, and then execute the files and call the functions. Your program wouldn't have to know which pages were available.
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