omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. resserone13v2.0

    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.


    R
    • Profile
    • Following 4
    • Followers 0
    • Topics 4
    • Posts 11
    • Best 2
    • Controversial 0
    • Groups 0

    resserone13v2.0

    @resserone13v2.0

    2
    Reputation
    7
    Profile views
    11
    Posts
    0
    Followers
    4
    Following
    Joined Last Online

    resserone13v2.0 Unfollow Follow

    Best posts made by resserone13v2.0

    • RE: How do you uninvent multiple lines of code in pythonista?

      @cvp I was able to open it on my phone and do all the indenting then open it back up on the Mac. i had to update the iCloud

      posted in Pythonista
      R
      resserone13v2.0
    • RE: trying to make parallelograms for Side wall

      I found this

      In parallelogram ABCDABCD {AB} = 10AB=10 and measured angle A = 60. Find {CD}CD

      and ask chatgpt to use it to make a parallelogram then mix that with what I had before

      it makes a parallelogram and now have to work on the size and placement

      import ui
      from scene import *
      
      
      def parallelogram(a, angle_of_a, color,  x_pos, y_pos):
          
          b = a
          
          # Calculate the coordinates of points B and C
          angle_A_rad = math.radians(angle_of_a)
          bx = a
          by = 0
          cx = bx + b * math.cos(angle_A_rad)
          cy = b * math.sin(angle_A_rad)
      
          # Create a path to draw the parallelogram
          path = ui.Path()
          path.move_to(bx, by)  # Point B
          path.line_to(cx, cy)  # Point C
          path.line_to(cx - a,cy + a)  # Point D
          path.line_to(bx - a, by + a)  # Point A
          path.close()
          # Create a shape node with the path
          parallelogram = ShapeNode(path=path)
          parallelogram.fill_color = color
          parallelogram.stroke_color = 'black'
          parallelogram.position = (x_pos, y_pos)
          return parallelogram
      
      
      class MyScene(Scene):
      	def setup(self):
      		self.background_color = 'white'
      		self.left_wall = parallelogram(400, 100, 'orange', self.size.w / 2, self.size.h / 2)
      		self.add_child(self.left_wall)
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)
      
      posted in Pythonista
      R
      resserone13v2.0

    Latest posts made by resserone13v2.0

    • how do I use ui.transform.rotation and anchor point on my vector shape

      want to rotate the shape and change the anchor point.

      anchor point gives me error.

      transform doesn't rotate the shape.

      parallelogram.anchor_point(0,0)
      
      # Rotate the parallelogram 180 degrees
      		transform = ui.Transform.rotation(180)
      		self.left_wall.transform = transform	
      

      I want to rotate the parallelogram 180 degrees. here's the complete code

      import ui
      from scene import *
      
      
      def parallelogram(a, angle_of_a, color,  x_pos, y_pos):
          
          b = a
          
          # Calculate the coordinates of points B and C
          angle_A_rad = math.radians(angle_of_a)
          bx = a
          by = 0
          cx = bx + b * math.cos(angle_A_rad)
          cy = b * math.sin(angle_A_rad)
      
          # Create a path to draw the parallelogram
          path = ui.Path()
          path.move_to(bx, by)  # Point B
          path.line_to(cx, cy)  # Point C
          path.line_to(cx - a,cy + a)  # Point D
          path.line_to(bx - a, by + a)  # Point A
          path.close()
          # Create a shape node with the path
          parallelogram = ShapeNode(path=path)
          parallelogram.fill_color = color
          parallelogram.stroke_color = 'black'
          parallelogram.position = (x_pos, y_pos)
          
          parallelogram.anchor_point(0,0)
          
          return parallelogram
      
      
      class MyScene(Scene):
      	def setup(self):
      		self.background_color = 'white'
      		self.left_wall = parallelogram(400, 100, 'orange', self.size.w / 2, self.size.h / 2)
      		
                      # Rotate the parallelogram 180 degrees
      		transform = ui.Transform.rotation(180)
      		self.left_wall.transform = transform		
      		
      		self.add_child(self.left_wall)
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)
      
      
      posted in Pythonista
      R
      resserone13v2.0
    • RE: How do you uninvent multiple lines of code in pythonista?

      @cvp I was able to open it on my phone and do all the indenting then open it back up on the Mac. i had to update the iCloud

      posted in Pythonista
      R
      resserone13v2.0
    • RE: trying to make parallelograms for Side wall

      I found this

      In parallelogram ABCDABCD {AB} = 10AB=10 and measured angle A = 60. Find {CD}CD

      and ask chatgpt to use it to make a parallelogram then mix that with what I had before

      it makes a parallelogram and now have to work on the size and placement

      import ui
      from scene import *
      
      
      def parallelogram(a, angle_of_a, color,  x_pos, y_pos):
          
          b = a
          
          # Calculate the coordinates of points B and C
          angle_A_rad = math.radians(angle_of_a)
          bx = a
          by = 0
          cx = bx + b * math.cos(angle_A_rad)
          cy = b * math.sin(angle_A_rad)
      
          # Create a path to draw the parallelogram
          path = ui.Path()
          path.move_to(bx, by)  # Point B
          path.line_to(cx, cy)  # Point C
          path.line_to(cx - a,cy + a)  # Point D
          path.line_to(bx - a, by + a)  # Point A
          path.close()
          # Create a shape node with the path
          parallelogram = ShapeNode(path=path)
          parallelogram.fill_color = color
          parallelogram.stroke_color = 'black'
          parallelogram.position = (x_pos, y_pos)
          return parallelogram
      
      
      class MyScene(Scene):
      	def setup(self):
      		self.background_color = 'white'
      		self.left_wall = parallelogram(400, 100, 'orange', self.size.w / 2, self.size.h / 2)
      		self.add_child(self.left_wall)
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)
      
      posted in Pythonista
      R
      resserone13v2.0
    • RE: trying to make parallelograms for Side wall

      this gets me close to the shape im looking for but its not using self .size and I don't think I will adjust to the screen size

      import ui
      from scene import *
      
      
      def create_wall(
      	x_start=None, y_start=None,
      	x_right_tc=None, y_right_tc=None,
      	x_right_bc=None, y_right_bc=None,
      	x_left_bc=None, y_left_bc=None,
      	x_left_tc=None, y_left_tc=None,
      	x_pos=None, y_pos=None,
      	color=None):
       
      	path = ui.Path()
      	path.move_to(x_start, y_start)  # Move to the top-left corner
      	path.line_to(x_right_tc, y_right_tc)  # Draw a line to the top-right corner
      	path.line_to(x_right_bc, y_right_bc)  # Draw a line to the bottom-right corner
      	path.line_to(x_left_bc, y_left_bc)  # Draw a line to the bottom-left corner
      	path.line_to(x_left_tc, y_left_tc)  # Draw a line to the top-left corner
      	path.close()  # Close the path to form a trapezoid
      
      	# Create a shape node with the trapezoid path
      	wall = ShapeNode(path=path)
      	wall.fill_color = color
      	wall.stroke_color = 'black'
      	wall.position = (x_pos, y_pos)
      
      	return wall
      
      
      class MyScene(Scene):
      
      	def setup(self):
      
      		# Create the left wall using the wall_maker function
      		self.left_wall = create_wall(
      			x_start=50, y_start=100,
      			x_right_tc=50, y_right_tc=100,
      			x_right_bc=200, y_right_bc=100,
      			x_left_bc=300, y_left_bc=300,
      			x_left_tc=250, y_left_tc=400,
      			x_pos=self.size.w / 2, y_pos=self.size.h /2,
      			color='orange'
      			)
      			
      		self.add_child(self.left_wall)
      
      	def did_change_size(self):
      		pass
      
      	def update(self):
      		pass
      
      	def touch_began(self, touch):
      		pass
      
      	def touch_moved(self, touch):
      		pass
      
      	def touch_ended(self, touch):
      		pass
      
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)
      
      
      posted in Pythonista
      R
      resserone13v2.0
    • RE: trying to make parallelograms for Side wall

      @resserone13v2-0 im not sure how to do this with self.size for all the parameters

      posted in Pythonista
      R
      resserone13v2.0
    • trying to make parallelograms for Side wall

      im tryng to make a 3d looking room and want the side walls to be parallelograms that connect to the back rectangle

      from scene import *
      import sound
      import random
      import math
      A = Action
      
      import ui
      from scene import *
      
      def wall_maker(x_start=None,
                     y_start=None,
                     to_right_tc=None,
                     to_right_bc=None,
                     to_left_bc=None,
                     x_pos=None,
                     y_pos=None,
                     color=None):
          path = ui.Path()
          path.move_to(x_start, y_start)  # Move to the top-left corner
          path.line_to(to_right_tc, y_start)  # Draw a line to the top-right corner
          path.line_to(to_right_bc, to_left_bc)  # Draw a line to the bottom-right corner
          path.line_to(to_right_bc, to_right_tc)  # Draw a line to the bottom-left corner
          path.line_to(to_right_bc, to_right_tc)  # Draw a line to the top-left corner
          path.close()  # Close the path to form a trapezoid
      
          # Create a shape node with the trapezoid path
          wall = ShapeNode(path=path)
          wall.fill_color = color
          wall.stroke_color = 'black'
          wall.position = (x_pos, y_pos)
      
          return wall
      
      class MyScene(Scene):
          def setup(self):
              self.main_node = Node(parent=self)
              self.background_color = 'gray'
      
              # Create the back wall
              self.back_wall = ShapeNode(ui.Path.rect(self.size.w * 0.1, self.size.h * 0.1, self.size.w * 0.60, self.size.h * 0.75))
              self.back_wall.position = (self.size.w / 2, self.size.h / 1.8)
              self.back_wall.line_width = 4
              self.back_wall.fill_color = 'orange'
              self.back_wall.stroke_color = 'black'
              self.main_node.add_child(self.back_wall)
      
      
              # Create the left wall using the wall_maker function
              self.left_wall = wall_maker(x_start=self.size.w * 0.1,
                                          y_start=self.size.h * 0,
                                          to_right_tc=375,
                                          to_right_bc=800,
                                          to_left_bc=-20,
                                          x_pos=self.size.w * 0.10,
                                          y_pos=self.size.h * 0.55,
                                          color='orange')
              self.add_child(self.left_wall)
      
              # Create the right wall using the wall_maker function
              self.right_wall = wall_maker(x_start=50,
                                           y_start=50,
                                           to_right_tc=400,
                                           to_right_bc=900,
                                           to_left_bc=-20,
                                           x_pos=self.size.w * 0.90,
                                           y_pos=self.size.h * 0.50,
                                           color='orange')
              self.add_child(self.right_wall)
      
              # Create the floor line
              self.floor_line = ShapeNode()
              self.floor_line.path = ui.Path()
              self.floor_line.path.line_width = 4
              self.floor_line.path.move_to(self.size.w * 0.75, self.size.h * 0.1)  # Move to the top-right corner
              self.floor_line.path.line_to(self.size.w * 0.1, self.size.h * 0.1)  # Draw a line to the top-left corner
              self.floor_line.fill_color = 'blue'
              self.floor_line.stroke_color = 'black'
              self.floor_line.position = (self.size.w * 0.50, self.size.h * 0.08)
              self.add_child(self.floor_line)
      
      
          def did_change_size(self):
              pass
      
          def update(self):
              pass
      
          def touch_began(self, touch):
              pass
      
          def touch_moved(self, touch):
              pass
      
          def touch_ended(self, touch):
              pass
      
      if __name__ == '__main__':
          run(MyScene(), show_fps=False)
      
      ![like this](https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.retrogames.cz%2Fgames%2F248%2FNES_01.gif&tbnid=3xiW2_4RJBWSxM&vet=12ahUKEwjn8KnugKP_AhX6O0QIHUnsDAsQMygFegUIARC3Ag..i&imgrefurl=https%3A%2F%2Fwww.retrogames.cz%2Fplay_248-NES.php&docid=9ydgQwkmSe7WrM&w=256&h=224&q=spy%20v%20spy%20nes&client=safari&ved=2ahUKEwjn8KnugKP_AhX6O0QIHUnsDAsQMygFegUIARC3Ag)
      posted in Pythonista
      R
      resserone13v2.0
    • RE: How do you uninvent multiple lines of code in pythonista?

      @cvp ok. I'll see what I can figure it out. Thanks

      posted in Pythonista
      R
      resserone13v2.0
    • RE: How do you uninvent multiple lines of code in pythonista?

      @cvp I'm using a mac mini with Pythonista. I don't see that menu. I used to use my iPad but it's a 4th gen and it doesn't work for some reason anymore Pythonista works fine but the iPad is just super slow. I got the mac mini so I could use Pythonista but I don't think it has the same menu. it is not allowing me to right click in Pythonista.

      aslo is there a way to edit multiple lines at the same time.. like if if want to add self to all these lines

      path = ui.Path()
          path.move_to(x_start, y_start)  # Move to the top-left corner
          path.line_to(to_right_tc, x_start)  # Draw a line to the top-right corner
          path.line_to(to_right_tc, to_right_bc)  # Draw a line to the bottom-right corner
          path.line_to(0, to_right_bc)  # Draw a line to the bottom-left corner
          path.close()  # Close the path to form a trapezoid
      
      posted in Pythonista
      R
      resserone13v2.0
    • How do you uninvent multiple lines of code in pythonista?

      How do you unindent multiple lines of code in pythonista? I tried shift tab but it's not working.

      posted in Pythonista
      R
      resserone13v2.0
    • RE: update and print list

      @cvp yes it worked perfect i used

      items = ''.join(str(item) for item in self.items)
      

      I did not add the + at the end of the f strings. it seems to be working fine.

      Thanks for your help.

      Ever since is been using Pythonista I've received lots of great help from the all of you in the forum.

      posted in Pythonista
      R
      resserone13v2.0