Re: Adding tkinter modules to notebook tabs [RESOLVED]

2020-04-05 Thread Rich Shepard

On Sat, 4 Apr 2020, Christian Gollwitzer wrote:


Add that thing instead of the frame.

blabla=BioDataForm() # whatever args it needs, maybe parent=nb

nb.add(blabla, text="Biodata")


Christian,

This clarifies my uncertainty and answers my question. Thanks.

PS: I suggest to change all Tk widgets to ttk widgets for optical reasons, 
but that's a side note.


I thought I had all as ttk; I'll check and correct as necessary.

Best regards,

Rich
--
https://mail.python.org/mailman/listinfo/python-list


Re: Adding tkinter modules to notebook tabs

2020-04-05 Thread Rich Shepard

On Sat, 4 Apr 2020, Terry Reedy wrote:


IDLE's currently-working Settings dialog uses a  ttl.Notebook with 5 tabs.
To see it, run IDLE and on the top menu, select Options => Configure IDLE.
Each tab displays a ttk.Frame with multiple widgets. Where there is a
choice, ttk widgets are used. They make the most different on macOS and
least difference on Windows (because the tk widgets look pretty good
there).

The code is in idlelib/configdialog.py.  ConfigDialog creates a window and 
notebook and adds the tab frames.  As Christian indicated, the notebook 
itself takes very little code.  Each of the tab frames is a separate Frame 
subclass in the same file, but they could be in separate files.


Thanks, Terry.

Regards,

Rich
--
https://mail.python.org/mailman/listinfo/python-list


Re: Adding tkinter modules to notebook tabs

2020-04-04 Thread Terry Reedy

On 4/4/2020 10:59 AM, Rich Shepard wrote:

My Python3-3.8.2 application has 8 modules with subject-specific data
entry/editing widgets and I want to display each module on a ttk.Notebook.
Each notebook resource I've found in my reference books and on the web
describe how to create a notebook and tabs and add labels to the tabs; a 
few
describe how to place individual widgets on a tab. But I've not found 
how to

place a widget-filled module on a notebook tab.


IDLE's currently-working Settings dialog uses a  ttl.Notebook with 5 
tabs.  To see it, run IDLE and on the top menu, select Options => 
Configure IDLE.  Each tab displays a ttk.Frame with multiple widgets. 
Where there is a choice, ttk widgets are used.  They make the most 
different on macOS and least difference on Windows (because the tk 
widgets look pretty good there).


The code is in idlelib/configdialog.py.  ConfigDialog creates a window 
and notebook and adds the tab frames.  As Christian indicated, the 
notebook itself takes very little code.  Each of the tab frames is a 
separate Frame subclass in the same file, but they could be in separate 
files.


--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Adding tkinter modules to notebook tabs

2020-04-04 Thread Christian Gollwitzer

Am 04.04.20 um 22:31 schrieb Rich Shepard:

On Sat, 4 Apr 2020, Christian Gollwitzer wrote:

I'm not sure I fully understand it, because a "module" is not defined 
in the language of tkinter.


Christian,

True, but it is in Python: a file ending in .py which, in this case,
contains a class of tkinter widgets.


Is it correct, you want to know how to place more than one widget - a
arrangement of widgets - onto a notebook tab?


Yes, as they are defined and laid out in separate files/modules.

This is achieved by a ttk.Frame() widget, which holds all the other 
stuff, and then you place the frame onto the notebook:


n=ttk.Notebook()
f1=ttk.Frame()
# put all your stuff into f1
n.add(f1, text="Module1")
# repeat for your other "modules"


This looks to me like it's adding the text, "Module1" to the tab.


Yes and no. It puts the empty frame in the notebook and labels it with 
"Module1" so that when you click the label, the frame is raised. Of 
course, not very interesting, because the frame is empty.




Here:

nb = ttk.Notebook(Main)
     ...
     page3 = ttk.Frame(nb)
     ...
     # add titles to tabs
     nb.add(page3, text='Biota')
     ...

This puts the text on each notebook tab, correct?


It adds an empty frame, as above.



If so, how do I add

class BiotaDataForm(Tk.Frame):

which defines all the widgets in the module in views/biota.py into the body
of the notebook's page3?


Add that thing instead of the frame.

blabla=BioDataForm() # whatever args it needs, maybe parent=nb

nb.add(blabla, text="Biodata")

Christian

PS: I suggest to change all Tk widgets to ttk widgets for optical 
reasons, but that's a side note.


--
https://mail.python.org/mailman/listinfo/python-list


Re: Adding tkinter modules to notebook tabs

2020-04-04 Thread Rich Shepard

On Sat, 4 Apr 2020, Christian Gollwitzer wrote:

I'm not sure I fully understand it, because a "module" is not defined in the 
language of tkinter.


Christian,

True, but it is in Python: a file ending in .py which, in this case,
contains a class of tkinter widgets.


Is it correct, you want to know how to place more than one widget - a
arrangement of widgets - onto a notebook tab?


Yes, as they are defined and laid out in separate files/modules.

This is achieved by a ttk.Frame() widget, which holds all the other stuff, 
and then you place the frame onto the notebook:


n=ttk.Notebook()
f1=ttk.Frame()
# put all your stuff into f1
n.add(f1, text="Module1")
# repeat for your other "modules"


This looks to me like it's adding the text, "Module1" to the tab.

Here:

nb = ttk.Notebook(Main)
...
page3 = ttk.Frame(nb)
...
# add titles to tabs
nb.add(page3, text='Biota')
...

This puts the text on each notebook tab, correct?

If so, how do I add

class BiotaDataForm(Tk.Frame):

which defines all the widgets in the module in views/biota.py into the body
of the notebook's page3?

Thanks,

Rich


--
https://mail.python.org/mailman/listinfo/python-list


Re: Adding tkinter modules to notebook tabs

2020-04-04 Thread Christian Gollwitzer

Am 04.04.20 um 16:59 schrieb Rich Shepard:

My Python3-3.8.2 application has 8 modules with subject-specific data
entry/editing widgets and I want to display each module on a ttk.Notebook.
Each notebook resource I've found in my reference books and on the web
describe how to create a notebook and tabs and add labels to the tabs; a 
few
describe how to place individual widgets on a tab. But I've not found 
how to

place a widget-filled module on a notebook tab.


I'm not sure I fully understand it, because a "module" is not defined in 
the language of tkinter. Is it correct, you want to know how to place 
more than one widget - a arrangement of widgets - onto a notebook tab?


This is achieved by a ttk.Frame() widget, which holds all the other 
stuff, and then you place the frame onto the notebook:


n=ttk.Notebook()
f1=ttk.Frame()
# put all your stuff into f1
n.add(f1, text="Module1")
# repeat for your other "modules"


Christian
--
https://mail.python.org/mailman/listinfo/python-list


Adding tkinter modules to notebook tabs

2020-04-04 Thread Rich Shepard

My Python3-3.8.2 application has 8 modules with subject-specific data
entry/editing widgets and I want to display each module on a ttk.Notebook.
Each notebook resource I've found in my reference books and on the web
describe how to create a notebook and tabs and add labels to the tabs; a few
describe how to place individual widgets on a tab. But I've not found how to
place a widget-filled module on a notebook tab.

I am asking for references I can read to learn how to do this.

Thanks in advance ... and stay healthy,

Rich

--
https://mail.python.org/mailman/listinfo/python-list