• brumm

    class User_Input_Date():
        def __init__(self):
    
            self.month_input = input('What was the month (1-12)')
            if self.month_input in ['01', '1', 'Jan', 'January', 'jan', 'january']:
                self.month_input = 1
            elif self.month_input in ['02', '2', 'Feb', 'February', 'feb', 'february']:
                self.month_input = 2
            elif self.month_input in ['03', '3', 'Mar', 'March', 'mar', 'march']:
                self.month_input = 3
            else:
                self.month_input = None
            self.year_input = int(input('What was the year?'))
            
        def printDate(self):
            print(f'year = {self.year_input} month = {self.month_input}')
            
    primary_bariatric_date = User_Input_Date()
    primary_bariatric_date.printDate()
    

    You store the variables with self.name instead returning it.

    posted in Pythonista read more
  • brumm

    
    button1.frame = (x, y,width,height)
    button2.frame = (x, y,width,height)
    
    v.add_subview(button1)
    v.add_subview(button2)
    

    posted in Pythonista read more
  • brumm

        def draw(self):
            self.iv.image.draw(0,0,self.width,self.height)
    

    you can only fit your image or you might like to calculate the screen ratio first...

    posted in Pythonista read more
  • brumm

    with Pythonista 3.2 +

    #...
            self.iv.image = ui.Image.named('lock_screen.png')
    
        def draw(self):
          self.iv.image.draw()
    #...
    

    it worked for me

    edit: btw. leave out the ImageView is also possible

    #...
            #self.iv = ImageView()
            #self.iv...
            self.image = ui.Image.named('lock_screen.png')
    
        def draw(self):
          self.image.draw()
    #...
    

    posted in Pythonista read more
  • brumm

    I don't use pytube, but youtube-dl is working pretty well for me.

    posted in Pythonista read more
  • brumm

    You only set the action function of your first button (4 times).

    b_top1.action = button_tapped
    

    In this function you need to test the self.title (SUM, DIV, ...) if you want to use it for all four operations.

    posted in Pythonista read more
  • brumm

    @cvp: For both 😄

    posted in Pythonista read more
  • brumm

    I bought the SQLed app for quick checking things. The downside is you have to "share..." the sqlite db between the apps.

    Btw. in the PythonCheatSheet is a sqlite section.

    posted in Pythonista read more
  • brumm

    import ui   #import needed library
    
    def tap(sender):   #define function before it is called
        print(sender.title)
    
    v = ui.View()
    v.frame = (0,0,400,400)
    v.name = 'test'
    
    b = ui.Button()
    b.title = 'use'
    b.action = tap
    b.background_color = 'white'
    b.border_color = 'blue'
    b.border_width = 1
    b.corner_radius = 5
    b.frame = (10,10,100,32)
    v.add_subview(b)
    
    ba = ui.Button()
    ba.title = 'buy'
    ba.action = tap
    ba.background_color = 'white'
    ba.border_color = 'blue'
    ba.border_width = 1
    ba.corner_radius = 5
    ba.frame = (110,10,100,32)
    v.add_subview(ba)
    
    v.present('sheet')
    

    ui help

    ui Tutorial

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!