亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

pygtk-進度條

系統(tǒng) 1967 0
    #!/usr/bin/env python

# example progressbar.py

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

# Update the value of the progress bar so that we get
 # some movement
def progress_timeout(pbobj):
	if pbobj.activity_check.get_active():
		pbobj.pbar.pulse()
	else:
		 # Calculate the value of the progress bar using the
		 # value range set in the adjustment object
		new_val = pbobj.pbar.get_fraction() + 0.01
		if new_val > 1.0:
			new_val = 0.0
	# Set the new value
		pbobj.pbar.set_fraction(new_val)

	# As this is a timeout function, return TRUE so that it
	# continues to get called
	return True

class ProgressBar:
 # Callback that toggles the text display within the progress
 # bar trough
	def toggle_show_text(self, widget, data=None):
		if widget.get_active():
			self.pbar.set_text("some text")
		else:
			self.pbar.set_text("")

		# Callback that toggles the activity mode of the progress
		# bar
	def toggle_activity_mode(self, widget, data=None):
		if widget.get_active():
			self.pbar.pulse()
		else:
			self.pbar.set_fraction(0.0)

	# Callback that toggles the orientation of the progress bar
	def toggle_orientation(self, widget, data=None):
		if self.pbar.get_orientation() == gtk.PROGRESS_LEFT_TO_RIGHT:
			self.pbar.set_orientation(gtk.PROGRESS_RIGHT_TO_LEFT)
		elif self.pbar.get_orientation() == gtk.PROGRESS_RIGHT_TO_LEFT:
			self.pbar.set_orientation(gtk.PROGRESS_LEFT_TO_RIGHT)

	# Clean up allocated memory and remove the timer
	def destroy_progress(self, widget, data=None):
		gobject.source_remove(self.timer)
		self.timer = 0
		gtk.main_quit()

	def __init__(self):
		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		self.window.set_resizable(True)

		self.window.connect("destroy", self.destroy_progress)
		self.window.set_title("ProgressBar")
		self.window.set_border_width(0)
		vbox = gtk.VBox(False, 5)
		vbox.set_border_width(10)
		self.window.add(vbox)
		vbox.show()
	
		# Create a centering alignment object
		align = gtk.Alignment(0.5, 0.5, 0, 0)
		vbox.pack_start(align, False, False, 5)
		align.show()
		
		# Create the ProgressBar
		self.pbar = gtk.ProgressBar()
		
		align.add(self.pbar)
		self.pbar.show()
		
		# Add a timer callback to update the value of the progress bar
		self.timer = gobject.timeout_add (100, progress_timeout, self)
		
		separator = gtk.HSeparator()
		vbox.pack_start(separator, False, False, 0)
		separator.show()
		
		# rows, columns, homogeneous
		table = gtk.Table(2, 2, False)
		vbox.pack_start(table, False, True, 0)
		table.show()
		
		# Add a check button to select displaying of the trough text
		check = gtk.CheckButton("Show text")
		table.attach(check, 0, 1, 0, 1,
		gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
		5, 5)
		check.connect("clicked", self.toggle_show_text)
		check.show()
		
		# Add a check button to toggle activity mode
		self.activity_check = check = gtk.CheckButton("Activity mode")
		table.attach(check, 0, 1, 1, 2,
		gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
		5, 5)
		check.connect("clicked", self.toggle_activity_mode)
		check.show()
		
		# Add a check button to toggle orientation
		check = gtk.CheckButton("Right to Left")
		table.attach(check, 0, 1, 2, 3,
		gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
		5, 5)
		check.connect("clicked", self.toggle_orientation)
		check.show()
		
		# Add a button to exit the program
		button = gtk.Button("close")
		button.connect("clicked", self.destroy_progress)
		vbox.pack_start(button, False, False, 0)
		
		# This makes it so the button is the default.
		button.set_flags(gtk.CAN_DEFAULT)
		
		# This grabs this button to be the default button. Simply hitting
		# the "Enter" key will cause this button to activate.
		button.grab_default ()
		button.show()
		
		self.window.show()
	
def main():
	gtk.main()
	return 0
	
if __name__ == "__main__":
	ProgressBar()
	main()

  

?

?


pygtk-進度條


pygtk-進度條
?
?

pygtk-進度條


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 天天se天天cao| 狼人综合伊人 | 夜色福利久久久久久777777 | 天天综合天天看夜夜添狠狠玩 | 欧美真人视频一级毛片 | 狠狠操亚洲 | 热综合一本伊人久久精品 | 爽爽影院免费观看视频 | 97精品国产 | 久青草影院在线观看国产 | 日产国产精品久久久久久 | 午夜欧美精品久久久久久久久 | 午夜色大片在线观看 | 亚洲国产第一区二区香蕉 | 精品乱人伦一区二区 | 韩国女主播一区二区三区视频 | 色综合手机在线 | 男人私人影院免费看视频 | 精品国产90后在线观看 | 色综合天天综久久久噜噜噜久久〔 | 日本精品视频在线观看 | 亚洲国产香蕉视频欧美 | 亚洲综合一区二区精品久久 | 日本大臿亚洲香蕉大片 | 久久国产乱子伦精品免费不卡 | 成人毛片在线播放 | 国产日韩一区二区三区在线播放 | 日韩专区亚洲精品欧美专区 | 国产在线观看91 | 亚洲综合色在线 | 国产一区二区三区高清 | 91高清在线成人免费观看 | 国产麻豆精品hdvideoss | 欧美香蕉爽爽人人爽观看猫咪 | 久久久久久久九九九九 | 天天夜夜操 | 欧美一级视频免费观看 | 伊人精品在线 | 欧美一区二区在线观看免费网站 | 深夜影院在线 | 九九热九九 |