0

Basically I'm trying to reprint this method every time a dropbox option is selected. However, the:

inscription "test", :margin => 1, :stroke => rgb(x, x, x)

Elements do not delete. They just append themselves to the old ones. I can't seem to find a way to clear them without clearing the entire stack! Is there a way to use Shoe's clear() for elements of the same type?

Please note, lots of this code is placeholder for other stuff, and that's why I'm throwing constants around like candy.

def drawHeatMap #(calculatedGeneArray) NOT IMPLEMENTED
        # rect 'Pixels across, pixels down, width, height'
        pixelsAcross = 32
        pixelsDown = 28
        size = 18
        for i in 1..30
            if i <= 15 
            inscription "test", :margin => 1, :stroke => rgb(0, 128, 0)
            elsif i > 15
            inscription "test", :margin => 1, :stroke => rgb(205, 92, 92)
            end
            for j in 1..10
                stroke rgb(0, 0, 0) 
                #Fills Blocks randomly  
                randomnumber = 1+rand(8)
                case randomnumber
                when 1
                    fill rgb(19, 231, 3)
                when 2
                    fill rgb(9, 99, 0)   
                when 3
                    fill rgb(3, 73, 0)
                when 4 
                    fill rgb(74, 74, 0)
                when 5
                    fill rgb(48, 47, 0)
                when 6
                    fill rgb(32, 32, 48)
                when 7 
                    fill rgb(41, 41, 41)
                when 8 
                    fill rgb(15, 15, 15)
                end
                rect pixelsAcross, pixelsDown, size, size
                #Fills Ovals Randomly
                randomnumber = 1+rand(4)
                case randomnumber
                when 4
                    fill white
                    nostroke
                    oval  (pixelsAcross+(size/2)),(pixelsDown+(size/2)), size/4, center:true
                end         
                pixelsAcross += 18      
            end
            pixelsDown += 18
            pixelsAcross = 32   
        end 
    end 
Darkstarone
  • 4,590
  • 8
  • 37
  • 74

1 Answers1

0

I cannot tell what and when do you want to remove but I think you can use the following principle:

Shoes.app do

  a=[]

  tmp=para "jkjkj"
  a << tmp
  tmp=para "sdfg"
  a << tmp

  button "jhjjh" do
   a.each{|l| l.remove}
  end

end
kwicher
  • 2,092
  • 1
  • 19
  • 28