Img                package:svWidgets                R Documentation

_M_a_n_i_p_u_l_a_t_e _i_m_a_g_e _r_e_s_o_u_r_c_e_s _f_o_r _t_h_e _G_U_I_s

_D_e_s_c_r_i_p_t_i_o_n:

     Mechanism provided here is very simple and allows for automatic
     loading of image resources from any package subdirectory.
     Currently, only Tk images loaded from GIF files are supported...
     but more formats will be added in the future.

_U_s_a_g_e:

       ImgGet(image)
       ImgNames()
       ImgType(image, warn = TRUE)
       tkImgAdd(file, type = "gif")
       tkImgDel(image)
       tkImgReadPackage(package, subdir = "gui", type = "gif")

_A_r_g_u_m_e_n_t_s:

   image: Name of an image 

    warn: Do we issue a warning if the type of image is not recognized? 

    file: Image file from where to download the resource 

    type: Type of image. Currently, only 'gif' is supported. 

 package: Name of a package from where to load image resources 

  subdir: Subdirectory in the package where the graphical resources are
          stored. By default, it is the "gui" subdirectory. 

_D_e_t_a_i_l_s:

     These functions care about (un)loading image resources. A list of
     these resources is maintained in '.gui.Imgs' located in the
     TempEnv environment.

_V_a_l_u_e:

     'tkImgAdd()' and 'ImgGet()' return the handle to the newly created
     image. 'ImgNames()' return the list of all images registered in
     .gui.Imgs.

_A_u_t_h_o_r(_s):

     Philippe Grosjean

_S_e_e _A_l_s_o:

     'WinNames'

_E_x_a_m_p_l_e_s:

       ## Not run: 
         ## These cannot be run by examples() but should be OK when pasted
         ## into an interactive R session with the tcltk package loaded

             ImgNames()
             tkImgAdd(file.path(.path.package(package = "svWidgets")[1], "gui", "logoSciViews.gif"))
             ImgNames()
             ImgType("$Tk.logoSciViews")
             # Place that logo in a Tk window
             timg <- tkWinAdd("timg", title = "A Tk window with image", pos ="-40+20")
             labImg <- tklabel(timg, image = ImgGet("$Tk.logoSciViews"), bg = "white")
             tkpack(labImg)
             # When the image resource is deleted, it is not displayed any more, but there is no error
             tkImgDel("$Tk.logoSciViews")
             ImgNames()
             tkWinDelete("timg")
             # To read all image resources at once (place this in .Lib.first())
             tkImgReadPackage("svWidgets")
             ImgNames()
       ## End(Not run)

