omz:forum

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

    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 2
    • Posts 13
    • Best 0
    • Controversial 0
    • Groups 0

    jgrincho

    @jgrincho

    0
    Reputation
    4
    Profile views
    13
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    jgrincho Unfollow Follow

    Latest posts made by jgrincho

    • RE: Is there a Template for IOS App with Header, Footer and Content areas (views)

      @JonB And the anchors-demo is a must... it provides of doing what I want and more... many thanks. Many thanks also to @mikael 's https://github.com/mikaelho/pythonista-anchor

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Is there a Template for IOS App with Header, Footer and Content areas (views)

      @JonB Many thanks for your help. I will only use content and footer - the upper space on the iPhone will do for the "header" by placing some buttons there.

      I will now try and look at the provided link to see if I can get something presentable.

      Flex is indeed tricky for a novice!

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Is there a Template for IOS App with Header, Footer and Content areas (views)

      @jgrincho said in Is there a Template for IOS App with Header, Footer and Content areas (views):

      Flex LRTBWH

      The first source of inspiration:

      https://github.com/tdamdouni/Pythonista/blob/master/_2017/ui-tutorial-beginner.py

      ... there is an update to it somewhere

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Connect to MariaDB

      @dealycont Indeed... that is also my way too go...

      posted in Pythonista
      jgrincho
      jgrincho
    • Is there a Template for IOS App with Header, Footer and Content areas (views)

      First I am a newbie to Python and Pythonista. Second I have been looking at some code and I am trying to learn by using and doing.

      The below code is mainly from a post somewhere with some modifications to try and adapt it to what I want:

      # Learning Alignment Options In UI
      # Pythonista
      # Flex LRTBWH
      
      import ui
      
      def make_label(name, texto, frame):
          return ui.Label(
              alignment=1,
              bg_color='lightgray',
              border_color='gray',
              border_width=1,
              frame=frame,
              flex=name,
              name=name,
              text=texto)
      
      def make_footer(name, texto, frame):
          return ui.Label(
              alignment=1,
              bg_color='white',
              border_color='lightgray',
              border_width=1,
              frame=frame,
              flex=name,
              name=name,
              text=texto)
      
      def passit():
          pass
      
      w, h = ui.get_screen_size()
      # h -= 64 # maybe to take away top of the screen which is not counted
      bh = bw = 60  # label height and button width
      mg = 10  # margin
      fw = w - (mg + mg) # footer width
      fh = 60 # footer height
      
      # header and screen wrapper - apparently combined
      view = ui.View(name='Demo X', bg_color='white', frame=(0, 0, w, h))
      mbtn_1 = ui.ButtonItem(title='➕ ', action=passit(), tint_color='red')
      mbtn_2 = ui.ButtonItem(title=' 👫 ', action=passit())
      mbtn_3 = ui.ButtonItem(title=' 👤', action=passit())
      view.right_button_items = (mbtn_3, mbtn_2, mbtn_1)
      
      # some elements in the content area - shouldn't I have a dedicated view for it?
      view.add_subview(make_label(name='RB', texto='TL', frame=(mg, mg, bw, bh)))
      view.add_subview(make_label(name='LB', texto='TR', frame=(w - (bw + mg), mg, bw, bh)))
      view.add_subview(make_label(name='RT', texto='BL', frame=(mg, h - (fh + bh + mg), bw, bh)))
      view.add_subview(make_label(name='LT', texto='BR', frame=(w - (bw + mg), h - (fh + bh + mg), bw, bh))) # fh space for footer
      view.add_subview(make_label(name='LRTB', texto='CNTR', frame=((w - bw) * .5, (h - (bh + fh)) * .5, bw, bh)))
      
      # footer - what is this LRTB?
      view.add_subview(make_footer(name='LRTB', texto=' 🏠 ️', frame=((w - (fw)) * .5, (h - (fh)), fw, fh))) # fh space for footer
      
      view.present()
      

      Despite displaying close to what I want this is not the way to do it. I am also getting puzzled by the flex LRTBWH and the correct way to use it.

      In my view one should set a view for the whole screen (h, w), one for the header which appears to be part of the screen, one for the content and one for the footer.

      Could anyone help or provide some hints or eventually point to a template?

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Connect to MariaDB

      @DavinE Many thanks!

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Connect to MariaDB

      @DavinE Can you share what you have done?

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Connect to MariaDB

      @jgrincho https://pymysql.readthedocs.io/en/latest/user/examples.html Working code:

      import pymysql.cursors
      
      connection = pymysql.connect(host='192.168.1.80',
      	user='user',
      	password='123456',
      	database='DataBase',
      	charset='utf8mb4',
      	cursorclass=pymysql.cursors.DictCursor)
      														
      with connection:
      	with connection.cursor() as cursor:
      		sql = "SELECT `shortname` FROM `users` WHERE `userid`=%s"
      		cursor.execute(sql, ('1',))
      		result = cursor.fetchone()
      		print(result)
      
      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Connect to MariaDB

      @JonB Tried no password, hacked the utf8 to be utf8mb4 but no success. Fortunately found (https://github.com/PyMySQL/PyMySQL) which is working fine...

      posted in Pythonista
      jgrincho
      jgrincho
    • RE: Connect to MariaDB

      @DavinE Hi. I finally manage to get it working from my iPad to a Raspberry PI running MariaDB. I am now using PyMySQL as my module and it works fine... https://github.com/PyMySQL/PyMySQL

      posted in Pythonista
      jgrincho
      jgrincho