Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Ui.Label - corner_radius -not working
-
@omz, it appears that ui.Label does not honour the corner_radius param.
-
technically, it does .. but the background and text does not use it, only the border..
as a workaround, you can use
ObjCInstance(lbl).clipsToBounds=True
to clip the background as well.
-
@JonB , thanks that did the trick. It does render correctly with the corner_radius in the ui Designer
-
@JonB , not being smart. But this solution is not as good as I thought it was. It delays the drawing of the label in this case. Not easy to show the code concisely. But the bottom line is that if you apply that treatment to the label, it's draw to the screen is delayed (after the present). I didn't notice it before. Just noticed it now when doing something different.i just mention because it's nice to have the rounded rect sometimes. Can soften a look.
It's not a huge issue, I will try to use a ui.Button or something. But also to let @omz it's not a 100% fix -
@Phuket2 The delay is likely the result of setting
clipsToBounds
on a non-main thread. Try something likeon_main_thread(lb.setClipsToBounds_)(True)
. -
@omz , sorry. I know it's been a while since been back to this. But your solution to stop the delayed drawing doesn't work. I get an attribute error that ui.Label does not have clipsToBounds attr. I tried a few variations but could not get it to work
-
@JonB , just as an FYI. Using your solution works but with the delayed redraw. If I present the view with animated=False, the keyboard has a redraw problem. Guessing connected to the issue that @omz mentions. Just to let you know
Edit: only if the keyboard is open when I run. If it's closed, it's looks correct