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.
Create and Rotate Label
-
Hello, how can I create and rotate a label of pi/2? I've already tried the GState() example, but when you input pi/2 the text disappears...
-
Can you post an example of what you tried?
-
I think I figured it out by myself. Here's the code, in case someone needs it!
# coding: utf-8 import ui from math import pi # Preliminary step: create an empty UI and call it myview # loading view v = ui.load_view('myview') # creating label ylabel = ui.Label() ylabel.text = 'Hello World' ylabel.center = (v.width/2., v.height/2.) #creating a transform object rot = ui.Transform.rotation(-pi/2) # applying the transform object to the label ylabel.transform = rot # adding the label to the view v.add_subview(ylabel) v.present()