Closed AaronMittelmeier closed 9 months ago
I suggest you specify button dimensions (height
and width
) for larger fonts.
[EDIT]
The "col is out of range" error comes from the writer
object: it is trying to render a character which extends beyond the boundaries of the screen. Please check your screen layout.
Initially, that's what I thought too, but I played with it for a long time to make sure that wasn't the case. With that in mind, as soon as I added the width parameters, as you advised, it worked as expected. I changed nothing else about the code (ie., those buttons hadn't moved), so what was it about the width parameter that enabled these to successfully render? My suspicion was that the default width of 50 in the button class (+ 10 ) may not be large enough to handle a font with a default size of '35'. After I modified default width to be 100, I could run the same code successfully. Long story short - I think the character boundary was related to button size, not screen size, in my circumstance.
Regardless, thank you again Sir! Your advice led to the resolution of this issue. I have added widths to the corresponding widgets and was successful in making those fonts bigger for these poor old eyes of mine.
That is odd, because I did a grep on the whole library and the only place that the "col is out of range" text occurs is here where the comparison is with the screen boundary.
The Button
class adapts its width to accommodate the passed text here. In principle the error could occur if the length of the passed text caused the button to extend past the width of the screen, but it doesn't seem to be the case here.
In my own applications I always specify the size of widgets to achieve a desired screen layout.
Well, honestly, having default dimensions are convenient but you're right, for a cleaner app, the way to go is specificity. Anyway, thanks once more. I'm gonna close this one out
When I attempt to use Arial 35 on a button in my base screen class, I am getting an unexpected error message: 'ValueError: col is out of range'. When I change to freesans20 on the exact same code, it runs clean. To demonstrate, change buttonWriter variable - font20 -> arial35 . This was also happening on courier20. Strangely, the listbox, is fine at arial35. What am I missing? Hardware is the 240x240 Waveshare 1.3 Pico LCD ST7789.
And this is the dice_roller function for completeness: