classification
Title: Ttk Notebook tabs do not show with 1-2 char names
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: Morb, serhiy.storchaka, terry.reedy, wordtech
Priority: normal Keywords:

Created on 2016-04-01 00:28 by terry.reedy, last changed 2016-10-24 23:12 by ned.deily. This issue is now closed.

Messages (6)
msg262712 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-04-01 00:28
From https://stackoverflow.com/questions/36336010/cannot-see-all-tabs-in-ttk-notebook

import tkinter as tk
from tkinter.ttk import Frame, Notebook

root = tk.Tk()
nb = Notebook(root, width=320, height=240)
nb.pack(fill='both', expand=1)
page0 = Frame(nb)
page1 = Frame(nb)
page2 = Frame(nb)
page3 = Frame(nb)
page4 = Frame(nb)
nb.add(page0, text="0")
nb.add(page1, text="1")
nb.add(page2, text="2")
nb.add(page3, text="3")
nb.add(page4, text="4")

Only tabs 0 and 1 show.  Add a space before or after the number and 2 & 3 show.  Add 6 spaces after 4 and '4 ' shows.  Appears to work OK with 3 chars, with first and third non-blank.

I presume this is a ttk bug.  http://www.tcl.tk/man/tcl8.6/TkCmd/ttk_notebook.htm#M14 just says 'a string'.  I plan to close this as 3rd party in a few days, but I wanted to document the defacto spec here on the tracker.
msg262719 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-04-01 04:09
I see the names of the first 4 tabs: 0-3. Tab header for the last tab is empty. If use longer name (e.g. "45678") I see it without two last characters ("456").

Yes, it looks as Ttk bug. Have you reported this to the mainstream?
msg262731 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-04-01 09:42
No, I can't remember where it is and do not have an account on their tracker, if one is needed.
msg262732 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-04-01 09:44
I am not surprised, somehow, that details of bug should depend on system.  I should have said Win 10, 3.5.1/8.6.4.
msg262894 - (view) Author: (Morb) Date: 2016-04-05 09:49
Hello, I'm the one who posted on stackoverflow.

I'm on Windows 7 Entreprise 64 bits (6.1, version 7601).
Here is my first line when I run python:
"Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32".

I think it's linked to the font and its size.
I tested some combinations:
  1 alphanumeric character, bugs (can only see 3 tabs on the 5)
  2 AN chars, bugs (last tabs almost hidden)
  3 AN chars, works
  1 space and 2 AN chars, bugs
  2 spaces and 2 AN chars, works
  2 spaces and 1 AN char, bugs (the last tab is almost hidden)
  3 spaces and 1 AN char, bugs
  4 spaces and 1 AN char, works
I tried the same with a different font (Courier, 12):
  1 alphanumeric character, bugs (the last tab is hidden)
  2 AN chars, works
  3 AN chars, works
  1 space and 2 AN chars, works
  2 spaces and 2 AN chars, works
  2 spaces and 1 AN char, works
  3 spaces and 1 AN char, works
  4 spaces and 1 AN char, works

The code I added for the font:
cfont = tkFont.Font(family="Courier", size=12)
s = ttk.Style()
s.configure('.', font=cfont)
msg279335 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-24 19:34
Tk bug tracker is http://core.tcl.tk/tk/ticket.

I don't think we can do something from our side.
History
Date User Action Args
2016-10-24 23:12:01ned.deilysetstatus: open -> closed
stage: resolved
2016-10-24 19:34:33serhiy.storchakasetresolution: third party
messages: + msg279335
2016-04-05 09:49:17Morbsetnosy: + Morb
messages: + msg262894
2016-04-01 09:44:26terry.reedysetmessages: + msg262732
2016-04-01 09:42:49terry.reedysetmessages: + msg262731
2016-04-01 04:09:02serhiy.storchakasetmessages: + msg262719
2016-04-01 00:28:21terry.reedycreate