omz:forum

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

    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 0
    • Followers 0
    • Topics 7
    • Posts 23
    • Best 0
    • Controversial 0
    • Groups 0

    mcarrara3

    @mcarrara3

    0
    Reputation
    753
    Profile views
    23
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    mcarrara3 Unfollow Follow

    Latest posts made by mcarrara3

    • RE: Drawing in subview

      I was stupid... missing set_needs_display in the showDrawing function!

      posted in Pythonista
      mcarrara3
      mcarrara3
    • Drawing in subview

      Hello,

      I have a simple view with a button and a subview where I want to draw. I want that the drawing happens when I press the button. I set up the following code

      # coding: utf-8
      import ui
      class DrawView (ui.View):
      	def __init__(self):
      		self.path = ui.Path()
      	def draw(self):
      		if self.path:
      			self.path.stroke()			
      def showDrawing(sender):
      	v = sender.superview
      	v['secondView'].path = ui.Path()	
      	v['secondView'].path.move_to(20,20)
      	v['secondView'].path.line_to(400,400)
      	v['secondView'].path.line_width = 5
      # Global View
      h, v = ui.get_screen_size()
      myView = ui.View()
      myView.background_color = 'red'
      myView.present('full_screen',hide_title_bar=True)
      # Adding Button
      myButton = ui.Button()
      myButton.frame = (50,50,v/3,100)
      myButton.title = 'Show Mesh'
      myButton.background_color = 'white'
      myButton.action = showDrawing
      myView.add_subview(myButton)
      # Adding Draw View
      drawView = DrawView()
      drawView.name='secondView'
      drawView.frame = (h/2,50,v/3,800)
      drawView.background_color = 'pink'
      #drawView.path = ui.Path()	
      #drawView.path.move_to(20,20)
      #drawView.path.line_to(400,400)
      #drawView.path.line_width = 5
      #drawView.path.stroke()
      myView.add_subview(drawView)
      

      but nothing happens if I handle the paths inside the action linked to the button. Any hint? Thank you in advance!

      posted in Pythonista
      mcarrara3
      mcarrara3
    • Feature Request: Aircode

      Hello, I really love Pythonista, but I am really missing the Aircode feature like Codea's one. Can you please consider to add it in the near future? Thanks!

      posted in Pythonista
      mcarrara3
      mcarrara3
    • RE: Feature Request: Aircode

      ccc, I've already saw this, but I am not very satisfied with it. Plus, if it's really 5 lines of code, wouldn't it be very easy to include in the next update?

      posted in Pythonista
      mcarrara3
      mcarrara3
    • Plot in Custom View

      Hello, I need to display a plot in a custom view, and I am having hard time trying to figure out how to do it. I found this https://gist.github.com/anonymous/4e792e1194816431f053 that pretty much does all the job already, but I have no clue on how to put the plot into a view. Any hint? Thanks!

      posted in Pythonista
      mcarrara3
      mcarrara3
    • RE: Plot in Custom View

      Here's the link to the code I have written/adapted that allows to draw plots directly into views. Enjoy!

      https://gist.github.com/38abe25c4be131851c14

      posted in Pythonista
      mcarrara3
      mcarrara3
    • 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...

      posted in Pythonista
      mcarrara3
      mcarrara3
    • RE: Create and Rotate Label

      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()
      
      posted in Pythonista
      mcarrara3
      mcarrara3
    • Import Classes from Another File

      Hello, this is probably a dumb question but I am having hard time in loading classes defined in another file (that has the same directory), into the current file. Any help would be really appreciated. Thanks!

      posted in Pythonista
      mcarrara3
      mcarrara3
    • RE: Import Classes from Another File

      worked perfectly!

      posted in Pythonista
      mcarrara3
      mcarrara3