homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkinter.font.Font object not usable as font option
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: asvetlov Nosy List: asvetlov, ilikepython, terry.reedy
Priority: normal Keywords:

Created on 2011年09月14日 18:39 by ilikepython, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (2)
msg144036 - (view) Author: (ilikepython) Date: 2011年09月14日 18:39
If a Font object is passed as a font option to a Tk widget e. g.:
import tkinter
import tkinter.font
f = tkinter.font.Font(family='Arial', size=30)
root = Tk()
label = tkinter.Label(root, text="Hello", font=f)
label.pack()
the font does not get respected at runtime.
msg157437 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012年04月03日 18:47
The test from ilikepython is incorrect, but after changing to:
import tkinter
import tkinter.font
root = tkinter.Tk()
w = tkinter.Frame(root)
f = tkinter.font.Font(root, family='Arial', size=30)
label = tkinter.Label(w, text="Hello", font=f)
label.pack()
w.pack()
root.mainloop()
it works.
Closing the issue.
History
Date User Action Args
2022年04月11日 14:57:21adminsetgithub: 57188
2012年04月03日 18:47:48asvetlovsetstatus: open -> closed

assignee: asvetlov
versions: + Python 3.3
nosy: + asvetlov

messages: + msg157437
resolution: works for me
stage: resolved
2011年09月16日 19:10:10terry.reedysetcomponents: + Tkinter
2011年09月16日 19:09:51terry.reedysetnosy: + terry.reedy
2011年09月14日 18:39:32ilikepythoncreate

AltStyle によって変換されたページ (->オリジナル) /