MCPcopy Index your code
hub / github.com/geekcomputers/Python / getPhotoImage

Method getPhotoImage

Flappy Bird - created with tkinter/Tubes.py:202–246  ·  view source on GitHub ↗

Retorna um objeto da classe PIL.ImageTk.PhotoImage de uma imagem e as imagens criadas de PIL.Image (photoImage, new, original) @param image: Instância de PIL.Image.open @param image_path: Diretório da imagem @param width: Largura da imagem @param hei

(
        image=None, image_path=None, width=None, height=None, closeAfter=False
    )

Source from the content-addressed store, hash-verified

200
201 @staticmethod
202 def getPhotoImage(
203 image=None, image_path=None, width=None, height=None, closeAfter=False
204 ):
205 """
206 Retorna um objeto da classe PIL.ImageTk.PhotoImage de uma imagem e as imagens criadas de PIL.Image
207 (photoImage, new, original)
208
209 @param image: Instância de PIL.Image.open
210 @param image_path: Diretório da imagem
211 @param width: Largura da imagem
212 @param height: Altura da imagem
213 @param closeAfter: Se True, a imagem será fechada após ser criado um PhotoImage da mesma
214 """
215
216 if not image:
217 if not image_path:
218 return
219
220 # Abre a imagem utilizando o caminho dela
221 image = openImage(image_path)
222
223 # Será redimesionada a imagem somente se existir um width ou height
224 if not width:
225 width = image.width
226 if not height:
227 height = image.height
228
229 # Cria uma nova imagem já redimensionada
230 newImage = image.resize([width, height])
231
232 # Cria um photoImage
233 photoImage = PhotoImage(newImage)
234
235 # Se closeAfter for True, ele fecha as imagens
236 if closeAfter:
237 # Fecha a imagem nova
238 newImage.close()
239 newImage = None
240
241 # Fecha a imagem original
242 image.close()
243 image = None
244
245 # Retorna o PhotoImage da imagem,a nova imagem que foi utilizada e a imagem original
246 return photoImage, newImage, image
247
248 def move(self):
249 """

Callers 2

__init__Method · 0.95
createNewTubesMethod · 0.95

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected