<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
<DIV>Hi!</DIV>
<DIV>It is no homework, in fact am I working ahead of class. I have now, after 
five minutes thinking, solved my problem, but a new problem has risen.</DIV>
<DIV>But to begin with, here is how I solved the problem:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>from tkinter import*</DIV>
<DIV>import time</DIV>
<DIV>&nbsp;</DIV>
<DIV>the_time=''</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>class Window(Frame):</DIV>
<DIV>&nbsp;&nbsp;&nbsp; def __init__(self,master):</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
super(Window,self).__init__(master)</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.grid()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.create_widgets()</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; def create_widgets(self):</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Create a hello button:</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
hej=self.hellobttn=Button(self,text="Hey")</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.hellobttn.grid(row=0, 
column=0)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Create a label that displays 
time:</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.display_time=Label(self, 
text=the_time)</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.display_time.grid(row=0, 
column=1)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; def 
change_value_the_time():</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; global 
the_time</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newtime 
= time.strftime('%H:%M:%S')</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
newtime != the_time:</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
the_time= newtime</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.display_time.config(text=the_time, font="40")</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
self.display_time.after(20, change_value_the_time)</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; change_value_the_time()</DIV>
<DIV>&nbsp;</DIV>
<DIV>root=Tk()</DIV>
<DIV>root.title("Test")</DIV>
<DIV>root.geometry("200x200")</DIV>
<DIV>app=Window(root)</DIV>
<DIV>root.mainloop()</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>I found some help on the internet about making a clock, although I had to 
modify a lot of the code to fit my own code and window.</DIV>
<DIV>Now to my next question. Say that I want a text “Hi, how are you?” to be 
printed when the time passes 15:00:00 each day. How do I do that?</DIV>
<DIV>&nbsp;</DIV>
<DIV>At first I thought that I could just write an if statement. Like:</DIV>
<DIV>&nbsp;</DIV>
<DIV>if the_time&gt;15:00:00:</DIV>
<DIV>&nbsp;&nbsp;&nbsp; print (“Hi, how are you?”)</DIV>
<DIV>&nbsp;</DIV>
<DIV>But it is obviously not working.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thank you for your help! Another question, am I supposed to add 
tutor@python.org<A href="mailto:tutor@python.org">tutor@python.org</A>; as copy? 
You did that, right?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Regards Mic</DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV style="FONT: 10pt tahoma">
<DIV>&nbsp;</DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=waynejwerner@gmail.com 
href="mailto:waynejwerner@gmail.com">Wayne Werner</A> </DIV>
<DIV><B>Sent:</B> Tuesday, November 15, 2011 10:14 PM</DIV>
<DIV><B>To:</B> <A title=o0MB0o@hotmail.se 
href="mailto:o0MB0o@hotmail.se">Mic</A> </DIV>
<DIV><B>Cc:</B> <A title=tutor@python.org 
href="mailto:tutor@python.org">tutor@python.org</A> </DIV>
<DIV><B>Subject:</B> Re: [Tutor] Clock in tkinter?</DIV></DIV></DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV 
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none">
<DIV class=gmail_quote>On Tue, Nov 15, 2011 at 2:00 PM, Mic <SPAN dir=ltr>&lt;<A 
href="mailto:o0MB0o@hotmail.se">o0MB0o@hotmail.se</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV dir=ltr>
  <DIV dir=ltr>
  <DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
  <DIV>Hi!</DIV>
  <DIV>I am new to programming and I hop this question isn’t 
  stupid.</DIV></DIV></DIV></DIV></BLOCKQUOTE>
<DIV>&nbsp;</DIV>
<DIV>Welcome! </DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV dir=ltr>
  <DIV dir=ltr>
  <DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
  <DIV><SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">I am 
  making a small GUI program. It is supposed to have a button and a clock in it 
  that displays the same time as it is according to the computer.</SPAN></DIV>
  <DIV>So as far as I am concerned both the clock and the are supposed to be 
  widgets?</DIV></DIV></DIV></DIV></BLOCKQUOTE>
<DIV>&nbsp;</DIV>
<DIV>Is this a homework assignment, or just something that you're doing for fun? 
It seems homework-ish. We don't mind pointing you in the right direction on 
homework assignments, but we definitely won't do it for you.</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV dir=ltr>
  <DIV dir=ltr>
  <DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
  <DIV>&nbsp;<SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">So how 
  do I add this clock as a widget placed next to the button?</SPAN><SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">&nbsp;</SPAN></DIV></DIV></DIV></DIV></BLOCKQUOTE>
<DIV>&nbsp;</DIV>
<DIV>Tkinter doesn't have a native clock widget, so if you want to make a clock 
you need to roll your own.</DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE 
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" 
class=gmail_quote>
  <DIV dir=ltr>
  <DIV dir=ltr>
  <DIV style="FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: 12pt">
  <DIV>&nbsp;<SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">Here is 
  the code I have written so far, that only displays a GUI window, and a 
  button:</SPAN></DIV>
  <DIV>&nbsp;<SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">&nbsp;</SPAN></DIV>
  <DIV>from tkinter import *</DIV>
  <DIV>import time</DIV>
  <DIV>&nbsp;<SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">&nbsp;</SPAN></DIV>
  <DIV>class Window(Frame):</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; def __init__(self,master):</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  super(Window,self).__init__(master)</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.grid()</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.create_widgets()</DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;&nbsp;&nbsp; def create_widgets(self):</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.test_button=Button(self, 
  text="Hi")</DIV>
  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  self.test_button.grid(row=0,column=0)</DIV>
  <DIV>&nbsp;<SPAN 
  style="BACKGROUND-COLOR: transparent; DIRECTION: ltr; FONT-SIZE: 12pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  </SPAN></DIV>
  <DIV>root=Tk()</DIV>
  <DIV>root.title("Test")</DIV>
  <DIV>root.geometry("200x200")</DIV>
  <DIV>app=Window(root)</DIV>
  <DIV>root.mainloop()</DIV></DIV></DIV></DIV></BLOCKQUOTE>
<DIV>&nbsp;</DIV>
<DIV>Giving us code (especially such a small amount) is exactly the right thing 
to do when you ask a question - it shows that you've tried something, and if 
it's broken it usually shows why it's broken.</DIV>
<DIV>&nbsp;</DIV>
<DIV>You can add text to the Label widget - and you can change the text on that 
widget.</DIV>
<DIV>&nbsp;</DIV>
<DIV>You're already importing the time module - for more information about what 
it contains, you can run the interactive interpreter and do this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; import time</DIV>
<DIV>&gt;&gt;&gt; help(time)</DIV>
<DIV>&nbsp;</DIV>
<DIV>Or you can look online for the commands that might help you.</DIV>
<DIV>&nbsp;</DIV>
<DIV>If you get stuck, let us know what you're doing and where you're stuck 
at.</DIV>
<DIV>&nbsp;</DIV>
<DIV>HTH,</DIV>
<DIV>Wayne</DIV></DIV></DIV></DIV></DIV></BODY></HTML>