ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Python newbie question

(1/4) > >>

kartal:
Hi Guys

I am working on my own alarm, countdown application. I do not have a gui setup now( will use wxpython). However I need a way to be able to print current time in a window(or command line) without printing every second in a new line. I can query time module to get the current time but I want to be able to print in a simple seperate window and terminate the window or time counting when the time is up. I have figured out the rest except printing time. This is for only testing the application not for final version. Currently I am using rudimentarty print command which prints the time on ever new line which is unpleasant.

thanks

Ehtyar:
I apologize in advance to Tin Man for treading on toes.

A little Googling would have found you the answer:

--- Code: Python ---import time def PrintStatic(a_string=''):        print '\b%s%s'%(a_string,'\b' * len(a_string)), PrintStatic("1")time.sleep(5)PrintStatic("2")From this ActiveState recipe, comment 4.

Ehtyar.

CWuestefeld:
I think you'll find that once you move to the GUI, this simply ceases to be an issue. For most GUI work you're not "printing" onto the screen; you're setting a property of a control (e.g. a text label), specifying the text that you want it to display. That control is in charge of (and the framework should contain all the implementation necessary for) rendering that value onto the screen.

Ehtyar:
That's certainly true CWuestefeld, but I think in many cases the console is superior when debugging an application.

Ehtyar.

kartal:
Ehtyar 
that code did not work here and it looks lke it was quite old. SO far I could not find any solution.

The reason I want to use the console is that it makes me keep things single. I am trying to make sure that my code works nice and easy for now :) A gui is definetely needed but it looks like too much coding and complication for me. Althout I have found the oa Constructor to be as a nice easy gui-python developement environment. I have not tried it fully but its gui construction kit looks sufficient.

Navigation

[0] Message Index

[#] Next page

Go to full version