# File tst/tst_locana.rb, line 541 def tst_images() Lwindow.new(:TestImages, :text=>'Test gif Images') { label(:label1, :sticky=>:nw, :pady=>10, :text=>'This tests several .gif or .bmp (depending on the GUI binding) image objects') # Please note that .jpg files are not support directly, you must save every # image as both .gif and .bmp for both tk and mswin32 to work with images. # Also note that tk changes .jpg to .gif and mswin32 change .jpg to .bmp. image(:i11, :sticky=>:nw, :below=>:prev, :padx=>5, :text=>'flower1', :filename=>'flower1.jpg', :filepath=>'images') image(:i12, :sticky=>:nw, :after=>:prev, :padx=>5, :text=>'flower2', :filename=>'flower2.jpg', :filepath=>'images') image(:i13, :sticky=>:nw, :after=>:prev, :padx=>5, :text=>'flower3', :filename=>'flower3.jpg', :filepath=>'images') image(:i14, :sticky=>:nw, :after=>:prev, :padx=>5, :text=>'flower4', :filename=>'flower4.jpg', :filepath=>'images') label(:label1, :sticky=>:nw, :pady=>10, :below=>:i11, :text=>'So you can see what happens when you limit the width(90) and height(90)') image(:i21, :sticky=>:nw, :below=>:prev, :padx=>5, :width=>90, :height=>90, :text=>'flower1', :filename=>'flower1.jpg', :filepath=>'images') image(:i22, :sticky=>:nw, :after=>:prev, :padx=>5, :width=>90, :height=>90, :text=>'flower2', :filename=>'flower2.jpg', :filepath=>'images') image(:i23, :sticky=>:nw, :after=>:prev, :padx=>5, :width=>90, :height=>90, :text=>'flower3', :filename=>'flower3.jpg', :filepath=>'images') image(:i24, :sticky=>:nw, :after=>:prev, :padx=>5, :width=>90, :height=>90, :text=>'flower4', :filename=>'flower4.jpg', :filepath=>'images') button(:b_ok, :sticky=>:se,:padx=>5, :pady=>5, :text => 'Ok') b_ok.on_click = 'close()' # this button will close the form self.on_load = %{ # this is done in the on_load event so it can be opened from within the GUI Builder path = find_valid_path('images', 'tst') # find the path for the images by checking the current directory and the 'tst' directory if (path) # check to see if the directory "images" exists, if not, we need to change the path of the images i11.filepath = i12.filepath = i13.filepath = i14.filepath = path i21.filepath = i22.filepath = i23.filepath = i24.filepath = path end } } end