当前位置: 首页>>代码示例>>Python>>正文


Python ImageTk.PhotoImage方法代码示例

本文整理汇总了Python中ImageTk.PhotoImage方法的典型用法代码示例。如果您正苦于以下问题:Python ImageTk.PhotoImage方法的具体用法?Python ImageTk.PhotoImage怎么用?Python ImageTk.PhotoImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ImageTk的用法示例。


在下文中一共展示了ImageTk.PhotoImage方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: aboutCommand

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def aboutCommand(self):
		if self.aboutroot == None:
			self.aboutroot = Toplevel()
			self.aboutroot.title('About')
			self.aboutroot.protocol("WM_DELETE_WINDOW", lambda: self.on_closing("aboutroot") )
			canvas = Canvas(self.aboutroot, width=300, height=300)
			image 			= Image.open("/usr/share/cownewsreader/media/background.png")
			image 			= image.resize((100, 100), Image.ANTIALIAS)
			self.img 		= ImageTk.PhotoImage(image)
			canvas.create_image(100, 20, image = self.img, anchor="nw")

			name = Label(canvas, text="CowNewsReader" ,anchor='w',font="monosa 11 bold")
			name.pack()
			canvas.create_window(80, 150, window=name, anchor='w')

			version = Label(canvas, text="1.0.0" ,anchor='w')
			version.pack()
			canvas.create_window(120, 180, window=version, anchor='w')

			copyright = Label(canvas, text="© 2016 Shkelqim Memolla" ,anchor='w')
			copyright.pack()
			canvas.create_window(80, 220, window=copyright, anchor='w')

			canvas.pack() 
开发者ID:blediboss,项目名称:CowNewsReader,代码行数:26,代码来源:MainWindow.py

示例2: displayDiff

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def displayDiff(val):
	global oldval
	newval=(val,my_var.get())
	if newval[0]!=oldval[0] or newval[1]!=oldval[1]:
		if my_var.get()==0:
			if newval[1]!=oldval[1]:
				imD=diffTransImage(img1,img2)
				scaletext.config(text="\nSlider has no Affect\n")

		elif my_var.get()==1:
			imD=diffError(img1,img2,int(val))
			scaletext.config(text="\nChange Tolerance\n")

		elif my_var.get()==2:
			imD=diffErrorOverlay(img1,img2,int(val))
			scaletext.config(text="\nChange Tolerance\n")
		elif my_var.get()==3:
			imD= overlayImage(img1,img2,int(val))
			scaletext.config(text="\nChange Image2 Transparency\n")

		else:
			imD=slideImage(img1,img2,int(val))		
			scaletext.config(text="\nSlide to Change Images\n")

		try:
			imD=imD.convert('RGB')
		except:
			pass		
		try:	
			img = ImageTk.PhotoImage(imD)
			panel.config(image=img)
			panel.image=img
		except UnboundLocalError:
			pass	
		oldval=newval 
开发者ID:samj1912,项目名称:imgdiff,代码行数:37,代码来源:diff.py

示例3: __init__

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def __init__(self,val,path,parent):
		self.val = int(val)
		self.pallete = self.getProminent(path,self.val)
		self.Tkimg = ImageTk.PhotoImage(self.pallete)
		self.TkL = Tkinter.Label(parent, image = self.Tkimg)
		self.TkL.pack(side = "left", fill = "both", expand = "yes") 
开发者ID:samj1912,项目名称:imgdiff,代码行数:8,代码来源:diff.py

示例4: __init__

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def __init__(self):

        self.passwd = None
        self.do_update = False

        # current working directory
        self.cwd = os.getcwd()
        self.bemoss_dir = self.cwd.replace('bemoss_gui', 'bemoss_os/')

        img_path = self.find_img()
        self.logo = ImageTk.PhotoImage(Image.open(img_path).resize((350,125)))
        self.img = ttk.Label(root, image=self.logo, justify='center')
        self.img.pack(fill=Tkinter.Y, expand=True, padx=5, pady=30)
        # logoimage

        self.ip_addr = self.getIPs()
        self.ipframe = Tkinter.LabelFrame(root, text='Your IP address:')
        self.ip_label = Tkinter.Label(self.ipframe, text=self.ip_addr, font=('Courier', 12, 'bold'))
        self.ip_label.pack()
        self.ipframe.pack(fill=Tkinter.X, expand=True, padx=15)
        # IP

        self.button_quit = ttk.Button(root, text='Run BEMOSS', command=self.run_software)
        self.button_quit.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True, pady=15, padx=10)
        self.button_runNode = ttk.Button(root, text='Run BEMOSS Node', command=self.run_software_asnode)
        self.button_runNode.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True, pady=15, padx=10)
        self.button_run = ttk.Button(root, text='Stop BEMOSS', command=self.stop_software)
        self.button_run.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True, pady=15, padx=10)
        self.button_adv = ttk.Button(root, text='Advanced Setting', command=self.adv_set)
        self.button_adv.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=True, pady=15, padx=10)


        # buttons 
开发者ID:bemoss,项目名称:bemoss_gui2.1,代码行数:35,代码来源:GUI.py

示例5: getPicture

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def getPicture(self, imgPath):
		File 		= imgPath
		image 		= Image.open(File)
		image 		= image.resize((100, 100), Image.ANTIALIAS)
		self.img 	= ImageTk.PhotoImage(image) 
开发者ID:blediboss,项目名称:CowNewsReader,代码行数:7,代码来源:MainWindow.py

示例6: set_background

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def set_background(self, np_array, color = False):
        """Takes a (numpy) array and sets this as background."""
        if color:
            img = Image.fromarray(np.flipud(np.uint8(np_array)), mode="RGB")
        else:
            img = Image.fromarray(np_array)
        if self.background_image_id:
            self.world_canvas.delete(self.background_image_id)
        img = img.resize(self.extents, Image.NEAREST)
        self.background_image = ImageTk.PhotoImage(img)
        self.background_id = self.world_canvas.create_image(0, 0,
            image=self.background_image, anchor=NW, tag="background")
        # Make sure drawing order is correct.
        self.set_display_order() 
开发者ID:tuongngoc,项目名称:slam-tutorial-code,代码行数:16,代码来源:gui.py

示例7: convert2byte

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def convert2byte(self, depth=255):
        (min, max) = self.getextrema()
        m = 1
        if max != min:
            m = depth / (max-min)
        b = -m * min
        return self.point(lambda i, m=m, b=b: i * m + b).convert("L")

    # returns a ImageTk.PhotoImage object, after rescaling to 0..255 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:11,代码来源:SpiderImagePlugin.py

示例8: tkPhotoImage

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def tkPhotoImage(self):
        import ImageTk
        return ImageTk.PhotoImage(self.convert2byte(), palette=256)

# --------------------------------------------------------------------
# Image series

# given a list of filenames, return a list of images 
开发者ID:cineuse,项目名称:CNCGToolKit,代码行数:10,代码来源:SpiderImagePlugin.py

示例9: open_image

# 需要导入模块: import ImageTk [as 别名]
# 或者: from ImageTk import PhotoImage [as 别名]
def open_image(self, res, res_label, src_label):
        fileName = tkFileDialog.askopenfilename()
        folder = path.split(fileName)[0]
        baseName = path.basename(fileName)
        name = path.splitext(baseName)[0]
        pngBaseName = name + '.final.png'

        srcImage = Image.open(fileName)
        tksrc = ImageTk.PhotoImage(srcImage)
        src_label.config(compound=BOTTOM, image=tksrc, text=baseName)
        src_label.image = tksrc
        top.update()
    
        size = 'png:w' + str(srcImage.size[0]) + ',h' + str(srcImage.size[1])
        process.launch_correct(fileName, size)
        pngName = path.join(folder, name, pngBaseName)
        resImage = Image.open(pngName)
        tkres = ImageTk.PhotoImage(resImage)
        res_label.config(compound=BOTTOM, image=tkres, text=pngBaseName)
        res_label.image = tkres
        top.update()

        buttonFrame = Frame(res)
        buttonFrame.pack(side=BOTTOM)

        goodButton = Button(buttonFrame, text="Good", command=self.good)
        goodButton.pack(side=LEFT)

        badButton = Button(buttonFrame, text="Bad", command=self.bad)
        badButton.pack(side=LEFT)

        editorButton = Button(buttonFrame, text="Open editor", command=lambda: self.editor(fileName))
        editorButton.pack(side=LEFT) 
开发者ID:ctrltz,项目名称:ocsr-project,代码行数:35,代码来源:gui.py


注:本文中的ImageTk.PhotoImage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。