python-idle

Delphi idle handler only fires when I move the mouse

无人久伴 提交于 2019-12-05 20:02:49
I have an OnIdle handler in my D2006 app. With this code: procedure TMainForm.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean); begin Inc (IdleCalls) ; Sleep (10) ; Done := False ; end ; the app runs smoothly, the idle handler is called 100 times per second, and the CPU usage is next to zero. I then added a TActionList and connected up some controls to actions, coded an Execute and Update handler. procedure TMainForm.ActionNewButtonExecute(Sender: TObject); begin DoNewProject ; end ; procedure TMainForm.ActionNewButtonUpdate(Sender: TObject); begin ActionNewButton.Enabled :=

Find new messages added to an imap mailbox since I last checked with python imaplib2?

社会主义新天地 提交于 2019-12-05 19:59:10
I am trying to write a program that monitors an IMAP mailbox and automatically copies every new incoming message into an "Archive" folder. I'm using imaplib2 which implements the IDLE command. Here's my basic program: M = imaplib2.IMAP4("mail.me.com") M.login(username,password) lst = M.list() assert lst[0]=='OK' for mbx in lst[1]: print "Mailboxes:",mbx def process(m): print "m=",m res = M.recent() print res M.select('INBOX') M.examine(mailbox='INBOX',callback=process) while True: print "Calling idle..." M.idle() print "back from idle" M.close() M.logout() It prints the mailboxes properly and

Python - subprocesses and the python shell

安稳与你 提交于 2019-12-05 13:08:45
I am trying to shell out to a non-python subprocess and allow it to inherit the stdin and stdout from python. - i am using subprocess.Popen This would probably work if I am calling from a console, but it definitely doesn't work when I am using the python shell (I am using IDLE by the way) Is there any way to convince python to allow a non python subprocess to print it's stdout to the python shell? This works both from a script and from the interactive interpreter, but not from IDLE: subprocess.Popen(whatever, stdin=sys.stdout, stdout=sys.stdin) You can't use the objects which IDLE assigns to

Detect change of browser tabs with javascript

此生再无相见时 提交于 2019-12-05 07:51:17
is there some way of detecting using javascript that a user has switched to a different tab in the same browser window. Additionally is there a way to detect a user has switched to a different window than the browser? thank you Trap the window.onblur event. It's raised whenever the current window (or tab) loses focus. Most probably there is no standards javascript for this. Some browsers might support it but normally there is only a window.onblur event to find out the user has gone away from the current window. The Page Visibility API was designed to do this. Have a read at this URL: https:/

Why does IDLE 3.4 take so long on this program?

人走茶凉 提交于 2019-12-05 03:42:51
This question was migrated from Code Review Stack Exchange because it can be answered on Stack Overflow. Migrated 5 years ago . EDIT: I'm redoing the question entirely. The issue has nothing to do with time.time() Here's a program: import time start=time.time() a=9<<(1<<26) # The line that makes it take a while print(time.time()-start) This program, when saved as a file and run with IDLE in Python 3.4, takes about 10 seconds, even though 0.0 is printed out from time.time() . The issue is very clearly with IDLE, because when run from the command line this program takes almost no time at all.

jTDS socket hanging with C3P0 connection check (SQL Server 2008 R2)

淺唱寂寞╮ 提交于 2019-12-05 01:22:58
问题 Here is the environment: Java 5 Web application running in Tomcat 6.0.18 on Windows (not sure the version) Database: SQL Server 2008 R2 JDBC Driver: jTDS 1.2.5 Connection pool provider: C3P0 0.9.1.2 I am trying to debug a problem that a client is having. Basically every couple weeks, our web application locks up on their server, and they can't access it. A restart fixes the issue. Further investigation shows that the reason everything is locked up is that everything is waiting on the database

How do I get rid of the ' the program is still running are you sure you want to kill it' warning on python?

好久不见. 提交于 2019-12-04 22:08:30
print ('Password Request Initiative') password = 'abcd' user_input = input('Please Enter Password: ') if user_input != password: print("Haha. Nope") quit() elif user_input == password: print ("User is now logged in...") enter code here that's the code, but when I run it and type the wrong password it shows this warning: And I want it to run without this message so it just instantly closes To avoid the message when running from IDLE, do not use quit() or exit() in a program. They are not part of the language and are not intended for this use. They are (usually) added by the site package for

Convert JSON to CSV using Python (Idle)

血红的双手。 提交于 2019-12-04 19:19:53
问题 I have a JSON file of Latitude/Longitude that I want to covert to a CSV file. I want to do this using Python. I have read/tried all other stackoverflow and google search results suggestions. I've managed to get as far as creating the CSV and including headers, but beyond that, goofy stuff starts to happen. Here is the working part of my code so far: import json, csv x="""[ {"longitude":"-73.689070","latitude":"40.718000"}, {"longitude":"-73.688400","latitude":"40.715990"}, {"longitude":"-73

IDLE's subprocess didn't make a connection. Either IDLE can't start or personal firewall software is blocking connection

北战南征 提交于 2019-12-04 19:09:44
I have tried uninstalling it and have searched other answers. None of them have worked; IDLE opens, but I can't run anything I write. This question has been asked before. Based on previous answers, I compiled a list of possible causes and solution on CPython tracker issue 25514 , post of 2016-01-18. SO question 1 Causes people have found or think they have found. Antivirus/firewall (4 people, linux iptables, Windows firewall, antivisus , so not a myth ;-) Shadow files, as described [in the issue], and in the python directory (about as common; example user file names: tkinter,py, subprocess.py)

Using “Edit with IDLE” with a Python 2.6.5 script

半腔热情 提交于 2019-12-04 18:01:23
I have installed both Python 2.7.1 and 2.6.5 versions on Windows. I have added only the path of Python 2.6.5 in the Environment Variables. Now, I want to run a Python script x.py using Python 2.6.5. I know how to do it using the cmd but It would be more convenient to just open it with IDLE and run inside it using the Run Module option. This is supposedly done by right-clicking over the script, and then going to Edit with IDLE option, but this opens and runs the script using Python 2.7.1. Is there a way to open and run it with Python 2.6.5? The standard command in the registry for Edit with