[Tutor] Clock in tkinter?

Mic o0MB0o at hotmail.se
Wed Nov 16 18:44:30 CET 2011


Okay, that is good to know.
Yes, I here is how I solved my problem:
def print_hi_15_00():
        time1=int(time.strftime('%H'))
        if time1>15:
            print("hi")

That worked fine.
However, if the time is say 15, I want it print 16 instead.
And if the time is 16, I want it to print 17 instead.

Here is how I thought to solve it.
time2=time1 + 1
print(time2)


...And apparently it worked now, when I tested it. It didn’t earlier...


I wonder if you have any suggestions regarding how to place widgets in my window.
Even though I try to arrange them as orderly as possible they get placed at all different kind of places in the window.
I use the grid method and place them in the window by using row=something and column=something.

It just doesn’t look good. It looks okay I suppose, but not as good as I want it to look.

I must admit though that I did not understand what you wrote earlier, refering to the fact that 
I don’t need global variables. I tried your suggestion of the function but didn’t get it to work.


So if I got it right. Inside the constructor (__init__) I should declare:
self.the_time=’’
Then, if I understood it right, I should also place the function call there?
self.update_time() as you refered to?

Oh, by top-posting you mean that I include everything I have written before in my post, and that it is no good to do?
So I just post what I wrote, and nothing from earlier on in this conversation?

Mic


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111116/46fa29aa/attachment.html>


More information about the Tutor mailing list