• jm2466

    Thanks again! Have been busy with work and have not had a chance to work on this. Hopefully will in a few days.

    posted in Pythonista read more
  • jm2466

    Perfect! Thanks!

    Can you now write a button that toggles to look pressed??? 😀

    posted in Pythonista read more
  • jm2466

    Thanks for the replies!

    I was able to create a custom view suggested by JonB to draw the grid lines. I also experimented with multiple sub views on a button but cvp’s example is definitely more complete.

    One other thing I need is a toggle button per say but basically a button that changes from normal to a “depressed” look when tapped.

    Another thing is scaling the font on the label/button. I want to make this work for different screen sizes (iPhone and iPad) and be as dynamic as possible. I am planning to size the cells based on the screen width which is in pixels. I did not see anything on the button for font size but did see a scaling on the label, however that just seems to be a best fit if more text is added (did not test it). I would like the single number in the cell to be larger than notes numbers.

    With those and the replies I think I have what I need to start putting this together.

    Thanks again!

    posted in Pythonista read more
  • jm2466

    I am trying to figure out the best way to create a sudoku cell that can accommodate notes. Since the cell needs to be touched I am thinking to start with a ui button. This is simple without notes as it will be blank or have the single number that goes in the cell. But adding notes brings a few challenges. One in that the notes “view” in the single cell needs to display a 3x3 grid for the numbers 1-9, with each cell in the grid having the number centered. The other is switching between the single solution number and the notes grid.

    In searching I saw something about adding sub views to a button but it was not clear on how to add multiple sub views and switch between them. The other is how best to do a 3x3 grid in a view: is each one a sub view that has to have absolute coordinates or is there a layout manager approach?

    One other thing not mentioned in the subject is drawing lines. In the documentation there is mention of needing a context but not sure how that relates to a view. Have not looked much into this yet as want to get the cells figured out. Just mentioning in case anyone has good examples of this.

    Thanks in advance

    Jay

    posted in Pythonista read more
  • jm2466

    Um... because you never told me to until now??? :) kidding of course. But honestly have no real answer to that question. Possibly because I wanted to save an in-memory image and not have to save the file locally first (at least that was the initial plan but is not where I am at with it now). Not sure if create image asset supports that (I tried passing the variable and got an error that a str is required).

    I just tried your suggestion and it works - I mean it saves the locally saved combined.jpg to the camera roll. Thanks!!!

    Any thoughts on how to get this to work without saving combined.jpg first???

    posted in Pythonista read more
  • jm2466

    Thanks. I tried that but it crashes trying to save the image to the camera roll. I can open the jpg in Pythonista and manually add it to the camera roll. Here are the lines at the end that I added:

        new_im.save('combined.jpg')
        del new_im
        photos.save_image(Image.open('combined.jpg'))
    
    

    posted in Pythonista read more
  • jm2466

    Unfortunately I do not.

    But if you look at the code in my original post I added one line in the for loop to delete the image (below is the loop from that post with the del at the end)

        for im in images:
            # paste in the image at the left edge (x=0) and current offset for y
            new_im.paste(im, (0,y_offset))
            print(f'y_offset = {y_offset}')
            # increase the offset by the height of current pic
            y_offset += im.size[1]
            del im 
    

    As mentioned that seemed to fix the issue pasting more than a few images into the new one.

    This line crashes Pythonista:

        photos.save_image(new_im)
    

    But I can save it to the Pythonista file system with the following:

        new_im.save('combined.jpg')
    

    posted in Pythonista read more
  • jm2466

    I added the del image after it is pasted into the merged image and that part appears to work. The program is now having a problem saving the merged image to the camera roll. If I instead save it to the Pythonista file system it works and is a workaround until the camera roll save is figured out. Any other thoughts on how to fix the camera roll save is greatly appreciated.

    posted in Pythonista read more
  • jm2466

    Thanks!!

    posted in Pythonista read more
  • jm2466

    Sorry for the delay in replying and thanks for the help.

    So from the above suggestions it appears deleting the photos once merged may be the best solution but I am not quite sure how to do that correctly. This is an extension so will receive the selected photos that I believe are just references/names of the photos and not the actual image - is that correct? My code then loops through the list and actually gets the photos and adds to a list. First it sounds like I should not get all of them before processing but rather merge each one as it is retrieved. Once that is done I need to “delete” it in the program, or really just delete/remove it from program memory what is the best way to do this without deleting the actual photo?

    Thanks

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!