Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with changing the tab position in a ttk::notebook.

115 views
Skip to first unread message

Donald Rozenberg

unread,
Oct 19, 2023, 3:06:00 AM10/19/23
to
Hi,
I am working on a GUI generator based on the tk and ttk widget sets and am having a problem with moving the tab position to the bottom edge of a ttk::notebook. It doesn't show the tabs but leaves room for them.

Consider the code:

ttk::notebook .nb -width 200 -height 100
ttk::frame .nb.f1; # first page
ttk::frame .nb.f2; # second page
.nb add .nb.f1 -text "One"
.nb add .nb.f2 -text "Two"
pack .nb
button .tn -text "Tabs to North" -command \
"ttk::style configure TNotebook -tabposition n"
pack .tn
button .ts -text "Tabs to South" -command \
"ttk::style configure TNotebook -tabposition s"
pack .ts
button .td -text "Default position" -command \
"ttk::style configure TNotebook -tabposition \"\""
pack .td

When you execute the code you see a ttk::notebook with two tabs in the default position. If you select the "Tabs to North" button the expected behavior
occurs.

If you select "Tabs to South" space is created for tabs at the bottom edge but the tabs do not appear.

If you select the Default position button the tabs go to nw as hoped for.

What am I doing wrong?

Alex P

unread,
Oct 19, 2023, 7:41:17 AM10/19/23
to
package require Tk
proc ::TabOrientation {{pos ""}} {
lassign [split [wm geometry .] x+] w h x y
ttk::style configure TNotebook -tabposition $pos
incr w 1
wm geometry . ${w}x${h}+${x}+${y}
update
incr w -1
wm geometry . ${w}x${h}+${x}+${y}
update
}
ttk::notebook .nb -width 200 -height 100
ttk::frame .nb.f1; # first page
ttk::frame .nb.f2; # second page
.nb add .nb.f1 -text "One"
.nb add .nb.f2 -text "Two"
pack .nb -fill both -expand 1
button .tn -text "Tabs to North" -command {::TabOrientation n}
pack .tn
button .ts -text "Tabs to South" -command {::TabOrientation s}
pack .ts
button .td -text "Default position" -command ::TabOrientation
pack .td

Alex P

unread,
Oct 19, 2023, 7:49:15 AM10/19/23
to
The above workaround looks like a silly attempt to fight a bug :(

Francois Vogel

unread,
Oct 21, 2023, 5:54:22 PM10/21/23
to Donald Rozenberg
Le 19/10/2023 à 09:05, Donald Rozenberg a écrit :
> I am having a problem with moving the tab position to the bottom edge of a ttk::notebook. It doesn't show the tabs but leaves room for them.

Thanks for the report and the ticket you have filed.

Follow-up to:

https://core.tcl-lang.org/tk/tktview/198376af5a

I have crafted a fix for this bug.

Regards,
Francois

Harald Oehlmann

unread,
Oct 22, 2023, 3:54:09 AM10/22/23
to
Great action, Francois, I appreciate !

Perhaps, Csaba, the visual magican, may comment on the question about
visual defects when the labels are left/right.

Take care,
Harald
0 new messages