shoes / shoes4

Shoes 4 : the next version of Shoes
Other
1.59k stars 194 forks source link

Image Clearing #1578

Open LWFlouisa opened 4 years ago

LWFlouisa commented 4 years ago

There was an issue with the clear command deleting everything. Image clearing didn't seem to do anything in Shoes 3. Has this problem been fixed in Shoes4?

Otherwise it just keeps stacking images, without the ability to clear the screen.

ccoupe commented 4 years ago

The clear command should delete everything in the slot. There have been improvements in Shoes 3 for managing the image cache That may help. You could file an issue with Shoes 3

LWFlouisa commented 4 years ago

Ah ok so it's an image cache issue? When I followed the advice a friend, that mentioned recreating the buttons every time you clear the screen:

Shoes.app do

  def clear_screen
    clear
  end

  def generate_poem
    system("ruby QRPoetry.rb")
  end

  # In this one, I can't seem to read the image unless it's in the main directory.
  def display_image
    image "poem.png"
  end

  def display_button
    button("Generate Poem") {
      c = clear_screen; i = image_clear; g = generate_poem; d = display_button; d = display_image
    }

    button("Exit") {
      exit
    }
  end

  flow do
    button("Generate Poem") {
      c = clear_screen; g = generate_poem; d = display_button; d = display_image
    }

    button("Exit") {
      exit
    }
  end

end

The system call refers to an external script that generates a QR code from a Ruby Gem, and I have the Shoes app display the image generated from the external script.