I'm trying to create a clock in PyGTK. But it looks like it gave some semantic error here:
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import pygtk
pygtk.require('2.0')
import gtk
from datetime import *
def relogio():
janela = gtk.Window()
janela.set_title("Relógio digital")
label = gtk.Label()
janela.add(label)
janela.connect("destroy", gtk.main_quit)
janela.show_all()
while 1:
label.set_markup("<big>" + str(datetime.now().hour) + ":" + str(datetime.now().minute) + ":" + str(datetime.now().second) + "</big>")
if __name__ == '__main__':
relogio()
gtk.mainloop()
Could you help me fix it? Note that by running the code with the interpreter, the window simply does not appear!