[Share Code] Rendering text with ui.draw_string
Phuket2 last edited by
This is not to share finished code. Just something I have been working on.
It's a class to render text using ui.draw_string. Handy for drawing into shapes images etc... What I have done is very limited, but still useful in some cases.
My interest in using ui.draw_string rather than using ui.Label etc... Is when trying to make light weight cells for ui.Table is one example. Adding text to icons/pictures etc. Many uses.
It can also be called using the with construct to act as a context manager. The context in this case is the instance attrs that are parameters to the drawing functions. I have been really struggling how to make a nice wrapper around the drawing functions in general because of the number of possibilities. ui.GState is great and helps a lot. But you have limited access to it.
Anyway, it's seems very nice to work with a object like this. It does bring it into context/focus. I think it should just be part of the language like it was in Visual Basic.
Anyway, as I say it's not finished. I am just edging forward. I want to be able to render the text as ui.TextView would.
If you are interested here is the gist