4

I'm trying to use Tk's "tk scaling" feature to zoom a GUI but it only seems to change the size of the widgets, not the text. Is it possible to use "tk scaling" with Tkinter and have it work appropriately? Here's my test script:

#!/usr/bin/python

from Tkinter import *

root = Tk()
root.tk.call('tk', 'scaling', '-displayof', '.', 50)
root.geometry('640x480+0+0')
label = Label(root, text='THis is some text')
button = Button(root, text='my button', command=root.quit)
label.pack()
button.pack()
root.mainloop()
martineau
  • 119,623
  • 25
  • 170
  • 301
  • 2
    What are the actual fonts you are using. The scaling factor is used only to calculate pixels based on a point size. If your fonts are defined by a pixel size (using a negative size) it won't affect them. – Bryan Oakley Aug 25 '11 at 00:56
  • 2
    System fonts will also be unaffected by the scaling factor; they'll just be whatever size the OS/font engine wants them to be. – Donal Fellows Aug 26 '11 at 12:55
  • There are other ways to do this. See [_How to change a widget's font style without knowing the widget's font family/size?_](http://stackoverflow.com/questions/4072150/how-to-change-a-widgets-font-style-without-knowing-the-widgets-font-family-siz) – martineau Jan 24 '17 at 01:48
  • Actually the font *is* scaled according to the display scaling (try it with different DPI settings and compare), it's just the tk geometry scaling is way off (it scales too much). – rustyx Mar 28 '22 at 21:49

0 Answers0