new

new(*args)
Class Public methods

Create a new image with the given options.

Examples of use :

Create an empty image of 300x200 pixels

image = TkPhotoImage.new(:height => 200, :width => 300)

Create an image from a file

image = TkPhotoImage.new(:file: => 'my_image.gif')

Options

Photos support the following options:

  • :data Specifies the contents of the image as a string.

  • :format Specifies the name of the file format for the data.

  • :file Gives the name of a file that is to be read to supply data for the image.

  • :gamma Specifies that the colors allocated for displaying this image in a window should be corrected for a non-linear display with the specified gamma exponent value.

  • height Specifies the height of the image, in pixels. This option is useful primarily in situations where the user wishes to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink vertically to fit the data stored in it.

  • palette Specifies the resolution of the color cube to be allocated for displaying this image.

  • width Specifies the width of the image, in pixels. This option is useful primarily in situations where the user wishes to build up the contents of the image piece by piece. A value of zero (the default) allows the image to expand or shrink horizontally to fit the data stored in it.

doc_ruby_on_rails
2015-06-07 03:06:31
Comments
Leave a Comment

Please login to continue.