• captainunivac

    Thanks, @omz! Will do.

    posted in Pythonista read more
  • captainunivac

    @omz
    I have a workaround for the position issue, but the font_size issue is less tractable.

    def my_draw_text(txt, x, y, **kwargs):
    """ my_draw_text(txt, x, y, **kwargs):

        The canvas.draw_text() method in this incarnation completely
        ignores the x and y parameters and just uses (0, 0). This
        function will use canvas.translate() to temporarily shift
        the origin to the desired point, draw the text, and then
        restore the gstate(). The keyword arguments (kwargs) are 
        font_name and font_size as in the canvas.draw_text() definition.
    """
    canvas.save_gstate()
    canvas.translate(x, y)
    canvas.draw_text(txt, 0, 0, **kwargs)
    canvas.restore_gstate()

    posted in Pythonista read more
  • captainunivac

    I am having problems with the canvas.draw_text() method. I have Pythonista 2.0 on an iPad and iPhone, and when I try to use the draw_text method it appears that the text is always drawn at (0, 0) in the current coordinate system. It also appears that the font_size parameter is ignored. This code on my implementation will draw the text with different fonts but with the same size and relative positions. What's up with that!

    coding: utf-8

    import canvas

    canvas.set_size(1000, 1000)
    canvas.translate(100, 100)
    canvas.draw_line(0 , 0, 50, 0)
    canvas.draw_line(0, 0, 0, 50)
    canvas.draw_text('Hello, World', 200, 200, font_name = 'Chalkduster', font_size = 64.0)
    canvas.translate(100, 100)
    canvas.draw_line(0 , 0, 50, 0)
    canvas.draw_line(0, 0, 0, 50)
    canvas.draw_text('Hello, World', 500, -200, font_name = 'Helvetica', font_size = 128.0)

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!