MCPcopy Index your code
hub / github.com/python/cpython / read

Method read

Lib/tkinter/__init__.py:4546–4577  ·  view source on GitHub ↗

Reads image data from the file named FILENAME into the image. The FORMAT option specifies the format of the image data in the file. The FROM_COORDS option specifies a rectangular sub-region of the image file data to be copied to the destination image. It must be a

(self, filename, format=None, *, from_coords=None, to=None, shrink=False)

Source from the content-addressed store, hash-verified

4544 self.tk.call(args)
4545
4546 def read(self, filename, format=None, *, from_coords=None, to=None, shrink=False):
4547 """Reads image data from the file named FILENAME into the image.
4548
4549 The FORMAT option specifies the format of the image data in the
4550 file.
4551
4552 The FROM_COORDS option specifies a rectangular sub-region of the image
4553 file data to be copied to the destination image. It must be a tuple
4554 or a list of 1 to 4 integers (x1, y1, x2, y2). (x1, y1) and
4555 (x2, y2) specify diagonally opposite corners of the rectangle. If
4556 x2 and y2 are not specified, the default value is the bottom-right
4557 corner of the source image. The default, if this option is not
4558 specified, is the whole of the image in the image file.
4559
4560 The TO option specifies the coordinates of the top-left corner of
4561 the region of the image into which data from filename are to be
4562 read. The default is (0, 0).
4563
4564 If SHRINK is true, the size of the destination image will be
4565 reduced, if necessary, so that the region into which the image file
4566 data are read is at the bottom-right corner of the image.
4567 """
4568 options = ()
4569 if format is not None:
4570 options += ('-format', format)
4571 if from_coords is not None:
4572 options += ('-from', *from_coords)
4573 if shrink:
4574 options += ('-shrink',)
4575 if to is not None:
4576 options += ('-to', *to)
4577 self.tk.call(self.name, 'read', filename, *options)
4578
4579 def write(self, filename, format=None, from_coords=None, *,
4580 background=None, grayscale=False):

Callers 2

test_readMethod · 0.95
readprofileMethod · 0.45

Calls 1

callMethod · 0.45

Tested by 1

test_readMethod · 0.76