我正在尝试制作一个时钟并将所有数字放在正确的位置,但它们都旋转了,例如 6 倒置而 12 是正确的。反正有没有只旋转文本而不是文本的位置?
我的代码是
push();
textSize(48);
for (int i = 1; i < 13; i++) {
int offset = -15;
if (str(i).length() == 2) {
offset -= 14.5;
}
rotate(radians(30));
text(i, offset, -350);
//println(i*30);
}
pop();
Run Code Online (Sandbox Code Playgroud) 如果我有代码:
names = ["Dave", "John", "Bob"]
Run Code Online (Sandbox Code Playgroud)
我想从我会做的名字中得到戴夫:
names[0]
Run Code Online (Sandbox Code Playgroud)
如果我现在有代码
class Friends:
def __init__(self, *people):
self.names = []
for v in people:
self.names.append(v)
names = Friends("Dave", "John", "Bob")
Run Code Online (Sandbox Code Playgroud)
现在要得到戴夫,我必须这样做:
names.names[0]
Run Code Online (Sandbox Code Playgroud)
是否有一种神奇的方法或类似的方法,以便我可以这样做:
names[0]
Run Code Online (Sandbox Code Playgroud)
再次得到戴夫?