473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Tkinter open and close over time...

Hello,

I was wondering if there was a way to make a tkinter window open and close over time. I would probably use the time module and time.sleep() to make it wait, but could I use a command to open a window and then close it after a certain amount of time? Sorry if I am being confusing, I am somewhat new to python and tkinter. Thanks for the help!

EG

I am using Vista 64-bit, and Python 3.0 (just in-case you needed to know).
Mar 5 '10 #1
2 2024
bvdet
2,851 Expert Mod 2GB
The thing to do would be open the window and trigger an event which saves the current time. Use widget method after() in the event command to call back the event command. Sample call:
Expand|Select|Wrap|Line Numbers
  1.     self.widget.after(1000, self.event_command)
The argument 1000 is in milliseconds. When the new time minus the saved time is the desired difference, call mainloop method quit(). Doing it this way, you can keep the window active and up dated.
Mar 5 '10 #2
Thanks a lot, and thanks for a quick response!

EG
Mar 5 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rob | last post by:
My first GUI so be gentle... When I start my program I call a class that runs the initial window. While in this class if a certain button is pressed it calls a function outside the class. This...
2
by: 3c273 | last post by:
Hello, I am trying to expand on a tutorial I am working through and I am not understanding something. In the following example if you click on the "New window" button, a new window appears with a...
1
by: Pekka Niiranen | last post by:
Hi there, after reading TkInter/thread -recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82965 I wondered if it was possible to avoid using threads for the following problem: ...
5
by: max(01)* | last post by:
hello. i wrote a very simple tkinter demo program that uses menus, buttons, labels, entries, frames and secondary toplevels. it is a python version of a java program made by a colleague. ...
2
by: import newbie | last post by:
Hi all, I'm a programming dabbler trying learn Python, and I've got a few questions. Mainly: Where can I find a good open-source library or tutorial (preferably free) that explains how to...
1
by: C D Wood | last post by:
To whom this may concern, Below is the source code, which demonstrates a problem I am having making a GUI for my python project work. 'table.txt' is a file that is read from the same folder....
1
by: Michael Yanowitz | last post by:
Hello: Below I have included a stripped down version of the GUI I am working on. It contains 2 dialog boxes - one main and one settings. It has the following problems, probably all related, that...
6
by: Dustan | last post by:
Nobody answered last time. I guess they wanted me to give it a shot. Well, here is how I download the image (it's a class method): def download_image(self):...
3
by: aldonnelley | last post by:
Hi all. Just having a weird problem with tkinter. I'm trying to make a gui that shows results from an image search, with a "forward" and "back" button so the user can compare results from...
3
by: J-Burns | last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in programming itself... :P. Need some help here. Problem 1: How do I make something appear on 2 separate windows using Tkinter? By...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.