I have written a module that clears the Interactive window of Active Python 2.2.2 and it works fine by its self but when I use it as an imported module then the clearing takes place after the rest of the main program has run. I'm using Mellinium at home but on NT at work it works fine.
The call to the module is the first statment after main(): in the calling program, the prog then goes on to extract info from web pages and display it to the Interactive window where upon the Interactive window is cleared.
The 'clear the Intractive window' prog does this by finding PythonWin window then using the keybd_event a few times, switches to the Interactive window, highlights all and deletes it as if you used the keys to do it
CTRL+I , CTRL+A and CTRL+X.
Is it something to do with threads? Im at a loss as I was for the file atributes ( that now works a treat - thanks)
THANKS in advance for any insight or where to start looking.
I'm really getting to like Python after a couple of weeks of frustration. Still needs more examples for everything.
Here are the programs first the HTML prog.
This could be any prog tho. I have taken out code that just makes the post long.
start = fini = -1
theLine = ""
sock = urllib.urlopen(htmlRef)
htmlSource = sock.readlines()
for x in htmlSource:
~~~~ code to strip out unwanted stuff
print "one done"
htmlRef = "http://uk.news.yahoo.com/22
if __name__ == "__main__":
and the clear win prog:
from win32gui import EnumWindows
from win32gui import SetActiveWindow
from win32gui import GetWindowText
from win32api import keybd_event
def EnumCallback( hwnd, extra ):
windows = 
wintexts = 
for each in windows:
to the Interactive Window
~~~ code to Clear the Interactive window screen