本文整理汇总了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()