omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. ccb_2k18

    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.


    • Profile
    • Following 1
    • Followers 0
    • Topics 2
    • Posts 8
    • Best 0
    • Controversial 0
    • Groups 0

    ccb_2k18

    @ccb_2k18

    0
    Reputation
    555
    Profile views
    8
    Posts
    0
    Followers
    1
    Following
    Joined Last Online

    ccb_2k18 Unfollow Follow

    Latest posts made by ccb_2k18

    • RE: How to make a loading bar?

      @cvp Thanks it worked perfectly! And yeah I realized @JonB, now i can adjust parameters since it works. Thank you both very much :)

      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • RE: How to make a loading bar?

      Here is the code for the alternate method. The line moves like a loading bar but it draws behind the sprite image.

      from scene import *
      import scene
      import ui
      
      class MyScene (Scene):
      	def setup(self):
      		self.background_color = 'grey'
      		self.sprite = SpriteNode('test:Boat', position=(self.size.w/2, self.size.h/2), scale=3.0, parent=self)
      		self.x = 200
      	def draw(self):
      		stroke('white')
      		stroke_weight(2)
      		line(200, 200, self.x, 200)
      		self.x += 1
      		if self.x > 400:
      			self.x = 400
      
      if __name__ == '__main__':
          run(MyScene(), show_fps=False)```
      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • RE: How to make a loading bar?

      I don’t know why it is the case, but even when I run it with the if statement you posted, nothing happens. It is like I cannot modify self.w after the init function, because I attempted altering it in setup with self.load.w but it did not affect the rectangle.

      from scene import *
      import scene
      import ui
      
      class load_bar(scene.ShapeNode):
      	def __init__(self, **kwargs):
      		self.w = 0
      		super().__init__(path=ui.Path.rect(0,0,self.w,5), fill_color='white', stroke_color=None, shadow=None, **kwargs) 
      
      class MyScene (Scene):
      	def setup(self):
      		self.background_color = 'grey'
      		self.load = load_bar(position=(200,200), parent=self)
      		self.load.anchor_point = (0,0)
      		self.load.w = 0
      	def update(self):
      		if self.load.w < 100.0:
      			self.load.w += 1
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)```
      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • RE: How to make a loading bar?

      @cvp Thanks, but it doesn’t seem to make a difference either way. But I did figure it out using the line() function which is much more simple. However the layer it draws on is always behind the spritenode background. How could I bring it to the front using scene or ui? I looked at a few examples similar to mine years ago but the functions they called seemed to have been removed from pythonista.

      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • How to make a loading bar?

      Hi all. I tried to demo a loading bar using a ShapeNode class. I used self.w as a variable for the width but it won’t update its width when I run the code. What must I change/add?

      from scene import *
      import scene
      import ui
      
      class load_bar(scene.ShapeNode):
      	def __init__(self, **kwargs):
      		self.w = 0
      		super().__init__(path=ui.Path.rect(0,0,self.w,5), fill_color='white', stroke_color=None, shadow=None, **kwargs)	
      	
      class MyScene (Scene):
      	def setup(self):
      		self.background_color = 'grey'
      		self.load = load_bar(position=(200,200), parent=self)
      		self.load.anchor_point = (0,0)
      		self.load.w = 0
      	def update(self):
      		while self.load.w < 100.0:
      			self.load.w += 1
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)```
      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • RE: How do I change a LabelNode overtime?

      Hey @cvp, would you care to help me again lol? I tried to demo a loading bar using a ShapeNode class. I used self.w as a variable for the width but it won’t update its width when I run the code.

      from scene import *
      import scene
      import ui
      
      class load_bar(scene.ShapeNode):
      	def __init__(self, **kwargs):
      		self.w = 0
      		super().__init__(path=ui.Path.rect(0,0,self.w,5), fill_color='white', stroke_color=None, shadow=None, **kwargs)	
      	
      class MyScene (Scene):
      	def setup(self):
      		self.background_color = 'grey'
      		self.load = load_bar(position=(200,200), parent=self)
      		self.load.anchor_point = (0,0)
      		self.load.w = 0
      	def update(self):
      		while self.load.w < 100.0:
      			self.load.w += 1
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)```
      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • RE: How do I change a LabelNode overtime?

      @cvp Thanks so much it worked perfectly! I don’t know why I didn’t think of modifying the text attribute.

      posted in Pythonista
      ccb_2k18
      ccb_2k18
    • How do I change a LabelNode overtime?

      Hello all, I am fairly new to Python, as well as Pythonista. I wanted to know if there is a way to change a LabelNode text overtime using the scene timer. I tried executing my code in the update function but it just keeps overlapping tons of text instead of altering the existing one. What am I doing wrong?

      from scene import *
      import sound
      import random
      import math
      A = Action
      
      class MyScene (Scene):
      	def setup(self):
      		self.clock = 0
      		self.background_color = 'black'
      		self.label = LabelNode(str(self.clock), font=('Courier', 40), color='white', position=(self.size.w/2, self.size.h/2), parent=self)
      	def update(self):
      		self.clock += int(self.t)
      		self.label = LabelNode(str(self.clock), font=('Courier', 40), color='white', position=(self.size.w/2, self.size.h/2), parent=self)
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)```
      posted in Pythonista
      ccb_2k18
      ccb_2k18