當前位置: 首頁>>代碼示例>>Python>>正文


Python Label.modify_fg方法代碼示例

本文整理匯總了Python中gtk.Label.modify_fg方法的典型用法代碼示例。如果您正苦於以下問題:Python Label.modify_fg方法的具體用法?Python Label.modify_fg怎麽用?Python Label.modify_fg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gtk.Label的用法示例。


在下文中一共展示了Label.modify_fg方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from gtk import Label [as 別名]
# 或者: from gtk.Label import modify_fg [as 別名]
	def __init__(self):
		super(HelloWorld, self).__init__()

		self.set_title("Time Tracker")
		self.set_size_request(600, 480)
		self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(6400, 6400, 6440))
		self.set_position(gtk.WIN_POS_CENTER)
		#self.set_border_width(20)
		
		total_hours = []
		total_minutes = []
		total_seconds = []

		prev_hours = "Hours: \n"
		prev_minutes = "Minutes: \n"
		prev_seconds = "Seconds: \n"

		vbox = gtk.VBox(False, 2)

		mb = gtk.MenuBar()
		filemenu = gtk.Menu()
		filem = gtk.MenuItem("File")
		filem.set_submenu(filemenu)
		exit = gtk.MenuItem("Exit")
		exit.connect("activate", gtk.main_quit)
		filemenu.append(exit)
		mb.append(filem)

		vbox.pack_start(mb, False, False, 0)

		table = gtk.Table(5, 6, True)

		button = gtk.ToggleButton(label = "Start")
		button2 = Button("Test")

		text = Label("Hello World")
		text.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFF'))
		prev_hours_label = Label(prev_hours)
		prev_hours_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFF'))
		prev_minutes_label = Label(prev_minutes)
		prev_minutes_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFF'))
		prev_seconds_label = Label(prev_seconds)
		prev_seconds_label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFF'))
		total = Label("Total: \n")
		total.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse('#FFF'))

		table.attach(button, 0, 3, 1, 2)
		table.attach(text, 0, 3, 0, 1)
		table.attach(prev_hours_label, 0, 1, 2, 6)
		table.attach(prev_minutes_label, 1, 2, 2, 6)
		table.attach(prev_seconds_label, 2, 3, 2, 6)
		table.attach(total, 3, 4, 2, 6)

		vbox.pack_end(table, True, True, 0)

		self.connect("destroy", self.destroy)

		button.connect("toggled", self.timer)

		# Assign relative self variable so all methods have access
		self.text = text
		self.button = button
		self.prev_hours_label = prev_hours_label
		self.prev_minutes_label = prev_minutes_label
		self.prev_seconds_label = prev_seconds_label
		self.prev_hours = prev_hours
		self.prev_minutes = prev_minutes
		self.prev_seconds = prev_seconds
		self.total_hours = total_hours
		self.total_minutes = total_minutes
		self.total_seconds = total_seconds
		self.total = total

		self.add(vbox)
		self.show_all()
開發者ID:mukulrawat1986,項目名稱:quittin-time,代碼行數:77,代碼來源:main.py


注:本文中的gtk.Label.modify_fg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。