Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 15th, 2012, 06:51 PM
Harris03 Harris03 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 13 Harris03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 41 m 27 sec
Reputation Power: 0
Question Tkinter Reminder MessageBox Show up

Hi everyone,

I am trying to create a reminder using Tkinter.

I can give the appropriate time and the same time change a label's text,but I want to show up a MessageBox,too.

My code is below:
(I am get an error like: "TkMessageBox not defined")

Code:
from Tkinter import *
import time
import tkMessageBox

form1=Tk()
form1.title('Project')
form1.resizable(width=FALSE, height=FALSE)
form1.geometry('1032x680+200+200')

time1 = ''
clock = Label(form1, font=('times', 20, 'bold'), bg='red')
clock.pack(fill=BOTH, expand=1)
def tick():
    global time1
    time2 = time.strftime('%H:%M:%S')
    if time2 != time1:
        time1 = time2
        clock.config(text=time2)
    clock.after(200, tick)
tick()
reminder = Label(form1, font=('remind', 20, 'bold'),bg='green')
reminder.pack(fill=BOTH , expand=1)
reminder.config(text="o reminder")
def hour():
    global x,y,z
    x=float(time.strftime("%H"))
    y=float(time.strftime("%M"))
    z=float(time.strftime("%S"))
    if y==37: reminder.config(text="First")
    if y==38:                       
        reminder.config(text="Second") 
        tkMessageBox.showinfo(text='Something',message='Else') 
    reminder.after(200,hour)
    
hour()

form1.mainloop()


If I comment the:

Code:
  tkMessageBox.showinfo(text='Something',message='Else')

..everything is ok.

But how can I show up a Messagebox...??


Thanks in advance.

Reply With Quote
  #2  
Old December 15th, 2012, 08:22 PM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,357 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 9 h 10 m 17 sec
Reputation Power: 383
Use a multi-line label.

How about the tkinter Dialog?

>>> import tkinter.messagebox as MB
>>> MB.askyesno()
False
>>>
__________________
[code]Code tags[/code] are essential for python code!

Reply With Quote
  #3  
Old December 16th, 2012, 03:18 AM
Harris03 Harris03 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 13 Harris03 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 41 m 27 sec
Reputation Power: 0
Quote:
Originally Posted by b49P23TIvg
Use a multi-line label.

How about the tkinter Dialog?

>>> import tkinter.messagebox as MB
>>> MB.askyesno()
False
>>>


You mean I have to use a tkMessageBox..?
(I have already used it but I am getting error.....
**Sorry in my code i forgot to import MessageBox..I am going to edit it right now**)

I want to show up a MessageBox rathen than a label, because it will be more useful for the user.

What is the use of False on your code...?


Thanks.

Reply With Quote
  #4  
Old December 16th, 2012, 06:36 AM
b49P23TIvg's Avatar
b49P23TIvg b49P23TIvg is offline
Contributing User
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Aug 2011
Posts: 3,357 b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level)b49P23TIvg User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 3 Days 9 h 10 m 17 sec
Reputation Power: 383
Please read manuals to find out what is available.

Please spend enough time using the python interpreter so you can distinguish the python prompt, the programmers' input, and python output.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Tkinter Reminder MessageBox Show up

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap