سؤال

I've got a weird problem here. I am setting the size of a text inside a canvas widget. Everything works fine on my laptop (arch linux x86_64). If I execute the same code on my Raspberry Pi (also arch linux armv6l) the font size just affects the gap between the letters. The size doesn't change.

class TextBild(tk.Canvas):
    def __init__(self, *args, **kwargs):
        tk.Canvas.__init__(self, *args, **kwargs)
        self.create_text(0, 
                         0, 
                         font = ('Helvetica', 30, 'bold'),
                         text = '000')

Do you have an idea why this is happening?

EDIT:

I found out that it works up to a size of 20. Also if I use a negative value for pixel size it only works lower than -20.

هل كانت مفيدة؟

المحلول

It sounds like you have bitmapped fonts in specific sizes, rather than scaleable fonts. Thus, when you request a font bigger than what is actually available, tkinter will pick the closest font and try to adjust the spacing to come as close as possible to what you're asking.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top