`
deepfuture
  • 浏览: 4427694 次
  • 性别: Icon_minigender_1
  • 来自: 湛江
博客专栏
073ec2a9-85b7-3ebf-a3bb-c6361e6c6f64
SQLite源码剖析
浏览量:80288
1591c4b8-62f1-3d3e-9551-25c77465da96
WIN32汇编语言学习应用...
浏览量:70768
F5390db6-59dd-338f-ba18-4e93943ff06a
神奇的perl
浏览量:103923
Dac44363-8a80-3836-99aa-f7b7780fa6e2
lucene等搜索引擎解析...
浏览量:287340
Ec49a563-4109-3c69-9c83-8f6d068ba113
深入lucene3.5源码...
浏览量:15118
9b99bfc2-19c2-3346-9100-7f8879c731ce
VB.NET并行与分布式编...
浏览量:68242
B1db2af3-06b3-35bb-ac08-59ff2d1324b4
silverlight 5...
浏览量:32498
4a56b548-ab3d-35af-a984-e0781d142c23
算法下午茶系列
浏览量:46239
社区版块
存档分类
最新评论

pygtk-image

 
阅读更多
#!/usr/bin/env python

# example images.py

import pygtk
pygtk.require('2.0')
import gtk

class ImagesExample:
 # when invoked (via signal delete_event), terminates the application.
	def close_application(self, widget, event, data=None):
		gtk.main_quit()
		return False

 # is invoked when the button is clicked. It just prints a message.
	def button_clicked(self, widget, data=None):
		print "button %s clicked" % data

	def __init__(self):

		# create the main window, and attach delete_event signal to terminating
		 # the application
		 window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		 window.connect("delete_event", self.close_application)
		 window.set_border_width(10)
		 window.show()

		 # a horizontal box to hold the buttons
		 hbox = gtk.HBox()
		 hbox.show()
		 window.add(hbox)

		 pixbufanim = gtk.gdk.PixbufAnimation("1.gif")
		 image = gtk.Image()
		 image.set_from_animation(pixbufanim)
		 image.show()
		 # a button to contain the image widget
		 button = gtk.Button()
		 button.add(image)
		 button.show()
		 hbox.pack_start(button)
		 button.connect("clicked", self.button_clicked, "1")

		 # create several images with data from files and load images int
		 # buttons
		 image = gtk.Image()
		 image.set_from_file("1.png")
		 image.show()
		 # a button to contain the image widget
		 button = gtk.Button()
		 button.add(image)
		 button.show()
		 hbox.pack_start(button)
		 button.connect("clicked", self.button_clicked, "2")

		 image = gtk.Image()
		 image.set_from_file("3.jpg")
		 image.show()
		 # a button to contain the image widget
		 button = gtk.Button()
		 button.add(image)
		 button.show()
		 hbox.pack_start(button)
		 button.connect("clicked", self.button_clicked, "3")
		 image = gtk.Image()
		 image.set_from_file("4.tif")
		 image.show()
		 # a button to contain the image widget
		 button = gtk.Button()
		 button.add(image)
		 button.show()
		 hbox.pack_start(button)
		 button.connect("clicked", self.button_clicked, "4")

		 image = gtk.Image()
		 image.set_from_file("5.gif")
		 image.show()
		 # a button to contain the image widget
		 button = gtk.Button()
		 button.add(image)
		 button.show()
		 hbox.pack_start(button)
		 button.connect("clicked", self.button_clicked, "5")

def main():
	gtk.main()
	return 0

if __name__ == "__main__":
	ImagesExample()
	main()

 



 

 

  • 大小: 25.6 KB
分享到:
评论

相关推荐

    isodumper:一种在 U 盘上写入 ISO 映像的工具。 它是 usb-imagewriter 的一个分支。 此存储库不再处于活动状态。 项目转至Mageia主机

    它是 usb-imagewriter 的一个分支。 我们还添加了格式化功能和 USB 设备内容备份。要求核心工具盘果波尔基特procps(或 procps-ng) pygtk2.0-libglade Python python-dbus Python分离磁盘终端执照本软件根据的条款...

    escrotum:受scrot启发,使用pygtk进行Linux屏幕捕获

    阴囊( ) 受scrot启发Linux屏幕捕获和屏幕录制程序。 为什么? 因为在刷新窗口中使用选择时scrot会出现故障 特征 全屏截图 屏幕录像 部分(选择)屏幕截图 ... FILENAME image filename, default is %Y-%m-%d-%H

    GTK

    它最初是为图像处理软件GIMP(GNU Image Manipulation Program)开发的,但随着时间的发展,GTK已经成为一个功能强大的跨平台GUI工具包,支持Windows、macOS等操作系统。 GTK的核心设计理念是模块化和可扩展性。它...

    GTK for Windows

    GTK最初是为图像处理软件GIMP(GNU Image Manipulation Program)设计的,后来发展成为一种通用的GUI工具包。它遵循GNU General Public License(GPL),确保了代码的自由分享和改进。GTK的核心特性包括组件丰富、可...

    GTK资料.rar

    GTK最初是为图像编辑软件GIMP(GNU Image Manipulation Program)设计的,但随着时间的发展,它已经成为一个功能强大的跨平台GUI构建框架。GTK使用C语言编写,并提供了多语言绑定,包括Python(PyGTK或GTK+ for ...

    一款实用的鼠标指针

    Python虽然不是专门用于图形用户界面(GUI)设计的语言,但它可以通过各种库和框架来实现这一目标,比如PyGTK、PyQt、wxPython或者Pyside等。 以PyQt为例,它是一个功能强大的Python GUI库,支持Qt框架的所有特性,...

    cicm-开源

    Cicm,全称为"Collection Image Manager",是一款基于Python(PyGTK+)开发的轻量级图像管理工具。它为用户提供了便捷的方式来浏览、组织和管理个人的图像集合。由于是开源软件,用户可以根据自己的需求对软件进行...

    GTK.rar_gtk

    GTK最初是为了支持图像处理软件GIMP(GNU Image Manipulation Program)而开发的,但现在它已经成为了一个功能强大的跨平台GUI框架。GTK使用C语言编写,同时也提供了多种语言的绑定,如Python(PyGTK)、Java(JGTK...

    python3+GTK+3.0的示例代码(包括GUI界面的控件示例,代码没有中文注释,英文不好的别下载)

    在Python3中,我们可以使用PyGTK或者PyGObject库来接入GTK+3.0的功能。 这个压缩包包含了一系列的示例代码,这些代码展示了如何使用Python3和GTK+3.0创建GUI界面的各种控件。虽然没有中文注释,但通过理解英文注释...

Global site tag (gtag.js) - Google Analytics