Thank you guys very much. That helps!
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.
Latest posts made by janaaron97
-
How do I combine two scenes?
I would like for someone to show me how to combine these two scenes into one:
from scene import * class dumb (Scene): def setup(self): self.x = self.size.w * 0.5 self.y = self.size.h * 0.5 def draw(self): background(0.00, 0.00, 0.00) fill(1.00,1.00,1.00) g = gravity() self.x += g.x * 10 self.y += g.y * 10 self.x = min(self.size.w - 100, max(0, self.x)) self.y = min(self.size.h - 100, max(0, self.y)) ellipse(self.x,self.y,100,100) class real (Scene): def setup(self): self.x = self.size.w * 0.4 self.y = self.size.h * 0.4 def draw(self): background(0.00, 0.00, 0.00) fill(1.00,1.00,1.00) g = gravity() self.x += g.x * 10 self.y += g.y * 10 self.x = min(self.size.w - 100, max(0, self.x)) self.y = min(self.size.h - 100, max(0, self.y)) rect(self.x,self.y,100,100) run(dumb()) run(real())
-
How to add two shapes
I'm trying to use the example program that discusses the gravity() function in Pythonista to learn the "scene" library.
What I want to do is have a square and a circle move around on the screen when I tilt the phone, at the same time. However, right now, there is only one shape.
How do I get both shapes to move on the screen?
Heres the code
from scene import * class dumb (Scene): def setup(self): self.x = self.size.w * 0.5 self.y = self.size.h * 0.5 def draw(self): background(0.00, 0.00, 0.00) fill(1.00,1.00,1.00) g = gravity() self.x += g.x * 10 self.y += g.y * 10 self.x = min(self.size.w - 100, max(0, self.x)) self.y = min(self.size.h - 100, max(0, self.y)) ellipse(self.x,self.y,100,100) class real (Scene): def setup(self): self.x = self.size.w * 0.4 self.y = self.size.h * 0.4 def draw(self): background(0.00, 0.00, 0.00) fill(1.00,1.00,1.00) g = gravity() self.x += g.x * 10 self.y += g.y * 10 self.x = min(self.size.w - 100, max(0, self.x)) self.y = min(self.size.h - 100, max(0, self.y)) rect(self.x,self.y,100,100) run(dumb()) run(real())
Thank you!
-
RE: How do I combine two scenes?
Is this what you meant?
from scene import * class dumb (Scene): def setup(self): self.x = self.size.w * 0.5 self.y = self.size.h * 0.5 def draw(self): background(0.00, 0.00, 0.00) fill(1.00,1.00,1.00) background(0.00, 0.00, 0.00) fill(1.00,1.00,1.00) g = gravity() self.x += g.x * 10 self.y += g.y * 10 self.x = min(self.size.w - 100, max(0, self.x)) self.y = min(self.size.h - 100, max(0, self.y)) ellipse(self.x,self.y,100,100) rect(self.x,self.y,100,100) run(dumb())
I tried that and it didn't work.