Closed hunter40415 closed 5 months ago
The reason set_textpos
is a separate method is that, having set the text position, the application might perform many printstring
calls with the text being added each time at the current cursor point. In other words, printstring
should not be constrained to an absolute location.
thanks for your explanation. I still a amateur at coding so I haven't thought about that. Anyway thanks to your work I have done many cool thing on my pico pi. (Mind my bad English vocabulary).
On Tue, Jan 9, 2024, 01:44 Peter Hinch @.***> wrote:
Closed #58 https://github.com/peterhinch/micropython-font-to-py/issues/58 as completed.
— Reply to this email directly, view it on GitHub https://github.com/peterhinch/micropython-font-to-py/issues/58#event-11421266993, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCPSMINGJB73VT6NLI3IHX3YNQ47XAVCNFSM6AAAAABBQM7OX2VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGQZDCMRWGY4TSMY . You are receiving this because you authored the thread.Message ID: @.*** .com>
You can always write your own function:
def print_at(wri, text, row, col):
Writer.set_textpos(display, row, col)
wri.printstring(text)
then you can write
wri = Writer(display, roman20)
print_at(wri, "Hello world", 0, 5)
I notice you use x
and y
. Graphics systems usually use row
, col
. The mathematical x
coordinate is col
, y
is row
. Just to confuse us :)
I suggest add this line into the code to avoid having to call out a coordinate every time which make the code look messy
which turn the code from this
to this
![image](https://github.com/peterhinch/micropython-font-to-py/assets/144647713/94b980d6-3102-4610-ad9b-be3178e8d155)