• DaveClark

    Hello

    I saw this a while ago

    How I use Python to blog my iPhone

    https://forum.omz-software.com/topic/4953/how-i-use-python-to-blog-my-iphone

    posted in Pythonista read more
  • DaveClark

    Hello

    The book "Doing Math With Python" has a chapter on drawing shapes and Fractals. Also some Mandelbrot stuff. I like this book because of the different examples.

    Good luck on your quest

    posted in Pythonista read more
  • DaveClark

    Here is the Pyui file

    Whoops5test.pyui

    [
      {
        "nodes" : [
          {
            "nodes" : [
              {
                "nodes" : [
    
                ],
                "frame" : "{{0, 0}, {540, 133}}",
                "class" : "Label",
                "attributes" : {
                  "name" : "label1",
                  "flex" : "WH",
                  "frame" : "{{195, 254}, {150, 32}}",
                  "uuid" : "F7EB115D-61EC-419E-BB26-7CEDC7ADEBC8",
                  "class" : "Label",
                  "alignment" : "center",
                  "text" : "Shock Shaft Speed",
                  "number_of_lines" : 0,
                  "font_size" : 26,
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{0, 459}, {540, 92}}",
                "class" : "Label",
                "attributes" : {
                  "name" : "label6",
                  "flex" : "WH",
                  "frame" : "{{195, 254}, {150, 32}}",
                  "uuid" : "536B313D-8792-4912-A7F0-9ED17CEF3818",
                  "class" : "Label",
                  "alignment" : "center",
                  "text" : "answer",
                  "font_size" : 24,
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{0, 141}, {274, 60}}",
                "class" : "Label",
                "attributes" : {
                  "name" : "label2",
                  "flex" : "WH",
                  "frame" : "{{195, 334}, {150, 32}}",
                  "uuid" : "ABB867F3-B6CB-41BF-B344-621A60512C75",
                  "class" : "Label",
                  "alignment" : "left",
                  "text" : "Motion Ratio?",
                  "font_size" : 22,
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{366, 141}, {174, 60}}",
                "class" : "TextField",
                "attributes" : {
                  "uuid" : "2AFA90FE-B716-4A95-82A4-3F522A466FC2",
                  "font_size" : 17,
                  "frame" : "{{170, 334}, {200, 32}}",
                  "action" : "",
                  "alignment" : "center",
                  "autocorrection_type" : "default",
                  "text" : "1",
                  "font_name" : "<System>",
                  "spellchecking_type" : "default",
                  "class" : "TextField",
                  "name" : "textfield1",
                  "flex" : "WH"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{0, 209}, {274, 60}}",
                "class" : "Label",
                "attributes" : {
                  "name" : "label3",
                  "frame" : "{{195, 334}, {150, 32}}",
                  "uuid" : "2EE9FFC0-FCF1-4996-8449-2A8C8DA8934C",
                  "class" : "Label",
                  "alignment" : "left",
                  "text" : "Whoop Height in inches?",
                  "font_size" : 22,
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{0, 278}, {274, 60}}",
                "class" : "Label",
                "attributes" : {
                  "name" : "label4",
                  "frame" : "{{195, 334}, {150, 32}}",
                  "uuid" : "DFF299B2-0881-46DC-AEF9-7EB993E46A2B",
                  "class" : "Label",
                  "alignment" : "left",
                  "text" : "Whoop Spacing in inches?",
                  "font_size" : 22,
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{0, 346}, {274, 60}}",
                "class" : "Label",
                "attributes" : {
                  "name" : "label5",
                  "frame" : "{{195, 334}, {150, 32}}",
                  "uuid" : "599966B1-4F08-45EE-ABD8-B8D9A75AA37E",
                  "class" : "Label",
                  "alignment" : "left",
                  "text" : "Vehicle Speed in mph?",
                  "font_size" : 22,
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{366, 208}, {174, 62}}",
                "class" : "TextField",
                "attributes" : {
                  "flex" : "WH",
                  "font_name" : "<System>",
                  "frame" : "{{170, 334}, {200, 32}}",
                  "spellchecking_type" : "default",
                  "class" : "TextField",
                  "uuid" : "2AFA90FE-B716-4A95-82A4-3F522A466FC2",
                  "alignment" : "center",
                  "text" : "15",
                  "autocorrection_type" : "default",
                  "name" : "textfield2",
                  "font_size" : 17
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{366, 278}, {174, 60}}",
                "class" : "TextField",
                "attributes" : {
                  "flex" : "WH",
                  "font_name" : "<System>",
                  "frame" : "{{170, 334}, {200, 32}}",
                  "spellchecking_type" : "default",
                  "class" : "TextField",
                  "uuid" : "2AFA90FE-B716-4A95-82A4-3F522A466FC2",
                  "alignment" : "center",
                  "text" : "15",
                  "autocorrection_type" : "default",
                  "name" : "textfield3",
                  "font_size" : 17
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{366, 346}, {174, 60}}",
                "class" : "TextField",
                "attributes" : {
                  "flex" : "WH",
                  "font_size" : 17,
                  "frame" : "{{170, 334}, {200, 32}}",
                  "spellchecking_type" : "default",
                  "class" : "TextField",
                  "uuid" : "2AFA90FE-B716-4A95-82A4-3F522A466FC2",
                  "alignment" : "center",
                  "text" : "40",
                  "autocorrection_type" : "default",
                  "name" : "textfield4",
                  "font_name" : "<System>"
                },
                "selected" : false
              },
              {
                "nodes" : [
    
                ],
                "frame" : "{{195, 586}, {168, 55}}",
                "class" : "Button",
                "attributes" : {
                  "flex" : "WH",
                  "action" : "",
                  "frame" : "{{230, 334}, {80, 32}}",
                  "title" : "Calculate",
                  "uuid" : "EA291EB5-371B-4AAE-A3D4-31BE3D10ACC5",
                  "class" : "Button",
                  "name" : "button1",
                  "font_size" : 22
                },
                "selected" : true
              }
            ],
            "frame" : "{{0, 0}, {540, 500}}",
            "class" : "ScrollView",
            "attributes" : {
              "flex" : "HRTB",
              "frame" : "{{110, 110}, {320, 320}}",
              "uuid" : "E616DE17-915E-41B3-BA80-AB2043AC2DDB",
              "content_height" : 720,
              "class" : "ScrollView",
              "content_width" : 540,
              "name" : "scrollview1"
            },
            "selected" : true
          }
        ],
        "frame" : "{{0, 0}, {540, 540}}",
        "class" : "View",
        "attributes" : {
          "enabled" : true,
          "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
          "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)",
          "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)",
          "flex" : ""
        },
        "selected" : false
      }
    ]
    

    posted in Pythonista read more
  • DaveClark

    Thanks for your help. Here is the code

    Whoops5.py

    import ui
    from SetTextFieldPad import SetTextFieldPad
    
    
    
    def getInput(view):
        textfield = v[view]
        input = textfield.text
        return input
    
    def calculate(motion, height, spacing, speed): 
        result = repr(round(motion * (height/(spacing*12/3/speed) / .0568))) + ' inches per second'   
        return result
    
    def button_tapped(sender):
        motion = float(getInput('textfield1'))
        height = float(getInput('textfield2'))
        spacing = float(getInput('textfield3'))
        speed = float(getInput('textfield4'))
        
        v['label6'].text = calculate(motion, height, spacing, speed) 
    
    
    
    #SetTextFieldPad(v['textfield1'])
    #SetTextFieldPad(v['textfield2'])
    #SetTextFieldPad(v['textfield3'])
    #SetTextFieldPad(v['textfield4'])
    
    v = ui.load_view('whoops5test')
    #button1.action = button_tapped
    button1 = v['button1']
    
    
    v.present('sheet')```
    
    Next I’ll send the Pruitt file

    posted in Pythonista read more
  • DaveClark

    the standard keyboard does come up and works. I am using the stock one for now.. Your keyboard has worked great on my other stuff that does not use a scrollview. I could put my code, but its the pyui file that I think needs work. or acutally, I need to code the scollview in the UI designed GUI, maybe. I dont know how to post the pyui file along with the py file

    posted in Pythonista read more
  • DaveClark

    Hello All

    I have a calculation thing that I did with the UI designer. It has four textfields and one button. It worked great, but one thing I did not like. When the keypad is up (the one cvp did, which is awesome) it blocked part of the form. I redid it with a scrollview to try to get it to scroll. I put the lables and the textfields and the button on the scrollview. Now it looks good and scrolls but now my code doesn’t connect to the UI interface. It does not read the button action or the text fields. I think I need to add a sub_view to the scrollview. I do not know for sure.

    Any help would be very much appreciated

    posted in Pythonista read more
  • DaveClark

    @cvp Oh my God. That’s it, You should see the mess I have got going in trying to incorporate your keypad. I guess I don’t get it yet, but I’m trying.

    Thank you so much for your help, and thank you for taking the time to help. I really enjoy the little programming projects I have and I am getting there

    Thanks again

    posted in Pythonista read more
  • DaveClark

    I have something that works on a iPad, but I would like to incorporate the new number pad in the program. This is where I’m at

    import ui
     
    def getInput(view):
        textfield = v[view]
        input = textfield.text
        return input
          
    def calculate(top, bottom): 
        result = repr(round(1/(1/top + 1/bottom))) + ' pounds per inch'   
        return result
        
    def button_tapped(sender):
        top = float(getInput('textfield1'))
        bottom = float(getInput('textfield2'))
        v['textfield3'].text = calculate(top, bottom) 
            
    v = ui.load_view('uitest')
    
    v['textfield1'].keyboard_type = ui.KEYBOARD_DECIMAL_PAD   
    v['textfield2'].keyboard_type = ui.KEYBOARD_DECIMAL_PAD  
     
    button1 = v['button1']
    button1.action = button_tapped
    v.present('sheet')
    

    How would I make your keypad be the default keypad.

    Any help would be very much appreciated

    posted in Pythonista read more
  • DaveClark

    Hello

    I just tried your program and it seems to work. iphone 6 plus, ios 11.4, pythonista 3.2

    I didn't know about your lexical stuff, it looks pretty cool

    posted in Pythonista read more
  • DaveClark

    @cvp Thank you for your help and quick answer on adding the decimal point to your keypad

    posted in Pythonista read more
  • DaveClark

    I write calculation type apps for my work. I like the simplicity of your number keyboard. It is straight forward and not a lot of noise. I would like to use it in my stuff on my iphone and ipad. How would I modify it to add a decimal point?

    any help would be very much appreciated

    posted in Pythonista read more
  • DaveClark

    Thanks for helping me. It took about 10 seconds to change it after I read about the While loop. I was tying to put the main function in the loop, which was wrong. I needed to put the main function call in the While loop.
    I have a bunch of calculations for use in the console but I want to put them into some kind of menu and page (with textboxes for answers) app so there can be a number keypad for ease of use

    Again, this forum never lets me down, Thanks guys and gals

    posted in Pythonista read more
  • DaveClark

    I am doing some calculation work and I have something that works, but I am having trouble making it run multiple times. I would like to run a bunch of different values but at the moment it only runs once in the console and kicks you out. How can I change this to run until the user stops the program. Thanks for any help

    import math
    
    
    def main():
            try:
                    bump=float(input('\nbump height? '))
                    tire=float(input('tire diameter in inches? '))
                    speed=float(input('vehicle speed in miles per hour? '))
                    
                            
            except ValueError:
                    print('\nyou entered an invalid input')
            else:
                  
                  print('the hub speed is ' + repr(round((calculatehubspeed(bump, tire, speed)))) + ' inches per second')
                  
    
    def calculatehubspeed(bump, tire, speed):
        
            answer = bump/(math.sqrt((tire/2)**2-((tire/2-bump)**2))/(speed*17.6))
    
            return(answer)
            
    
    if __name__ == '__main__':
    
     main()
    
                    ```

    posted in Pythonista read more
  • DaveClark

    Wow

    The economy of your art is exquisite

    posted in Pythonista read more
  • DaveClark

    What a great sample program. I too am a beginner programmer. Your code has been fun to play with. I messed around and did some changes you might like. I made it just print out the final result, even runnng it to 100000 coin flips, it fast enough to run big numbers

    import random
    
    def coinToss():
        number = int(input("Number of times to flip coin: "))
       
        recordList = []
        Heads = 0
        Tails = 0
        for amount in range(number):
            flip = random.randint(0,1)
            if (flip == 0):
                #print("Heads")
                recordList.append('Heads')
            else:
                #print("Tails")
                recordList.append("Tails")
            #print(str(recordList))
    
        s = (str(recordList.count("Heads")) + ' heads  ' + str(recordList.count("Tails")) + ' tails')
            
        print(s)
        print()
    
    coinToss()
    

    posted in Pythonista read more
  • DaveClark

    Hello

    Once you see it you will understand.

    Get to where you can see the program lines of a file. Create a new program if you need a place to start. Touch the screen to bring up the keyboard. Now, swipe left, you will now see that you are in the "console" with the keyboard still showing. But now there is an extra line right above the keyboard. This line has the greater than sign (>) on the left with a blinking vertical line as input.

    Now you can enter simple stuff like "2+2" and other python stuff. Way simple and fun.

    This is awesome and you have fun

    posted in Pythonista read more
  • DaveClark

    @mikael said:

    @DaveClark, did you update to 11.2.5?

    Yes I did update to 11.2.5

    @zrzka Thanks for the good info

    posted in Pythonista read more
  • DaveClark

    OK. I changed the

    return pressure.CGFloatValue()

    to

    return pressure.floatValue()

    and it works again. I still don't understand how it worked earlier.

    Thanks for pointing me in the right direction

    posted in Pythonista read more
  • DaveClark

    It was working after I change line 28 to your suggestion. But today without changing anything(I think)

    line 28 was return pressure

    line 28 now return pressure.CGFloatValue()

    Now it is showing an error message complaining about line 28. It says:

    AttributeError
    no method found for
    CGFloatValue

    again, I am at a loss

    posted in Pythonista read more
  • DaveClark

    That did it and now I know I need to read the documents more. Thanks you for your help

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!