python-idle

Python - ctrl L does not work

半腔热情 提交于 2019-12-10 17:46:02
问题 Attempting to use Ctrl + L for clearing Power Sheel in Python 2.7.8 I get no response. Is there any problem in Windows 10 ? 回答1: Ctrl + L only works on Linux/OS X terminals. It does not work on Windows. To clear the screen on Windows you could do the following: import os os.system('cls') 回答2: To extend Kredns answer to Linux/OS X terminals as well: import os os.system('clear') 回答3: I like Kredns's answer, however, you have to type all of that every time. I made a module/function. Okay, I am

Python 3.2 Idle vs terminal

◇◆丶佛笑我妖孽 提交于 2019-12-10 17:02:46
问题 In python 3.2 under OSX, if I'll run "type(sys.stdin)" under Idle I get a strange answer as shown below >>> type(sys.stdin) <class 'idlelib.rpc.RPCProxy'> >>> But if I'll reun the same command under terminal, I get: >>> import sys >>> type(sys.stdin) <class '_io.TextIOWrapper'> >>> I understand this is because I'm running it under IDLE. but is this not misleading? I was trying to run the following commands in IDLE and spent hours trying to understand as to why this is not working. (I'm still

Idlex 1.13 : Unable to located “idlexlib”

穿精又带淫゛_ 提交于 2019-12-10 16:04:13
问题 I really like IDLE because it's simple and intuitive, not to mention it is lightweight, but one turnoff is its lack of Line Numbers which is very important (for me). I installed Python 3.6.0 for all users and then installed IdleX (python setup.py install), both as Admin. The setup went smoothly and the console displayed all processes just fine. However, when I tried to run idlex, an error showed: Unable to located "idlexlib". Make sure it is located in the same directory as "idlexlib" or run

Can I set IDLE to start Python 2.5 by default?

懵懂的女人 提交于 2019-12-10 10:36:54
问题 Ok, so I just installed Python 2.7, but I all ready had python 2.5. I realized that because I installed Python 2.7 last, IDLE automatically opens Python 2.7 IDLE, which I don't want. Is there any way to set the Python 2.5 IDLE to automatically open when I use the right click option on a python source file? Thanks. 回答1: You can easily create or edit the right-click properties for a file. To edit the right-click menu for a particular file extension: Run assoc .py from the command line and note

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

江枫思渺然 提交于 2019-12-10 10:12:53
问题 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

Detect change of browser tabs with javascript

≯℡__Kan透↙ 提交于 2019-12-10 04:24:37
问题 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 回答1: Trap the window.onblur event. It's raised whenever the current window (or tab) loses focus. 回答2: 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

Why does IDLE 3.4 take so long on this program?

女生的网名这么多〃 提交于 2019-12-10 03:14:37
问题 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

How to tell whether imaplib2 idle response resulted from timeout

别等时光非礼了梦想. 提交于 2019-12-09 19:31:16
问题 I'm using imaplib2 (docs) to interact with an IMAP server. I'm using the idle command, with a timeout and a callback. The problem is, I don't see any way of telling if the callback was triggered by the timeout being reached, or if there was a change on the server that I need to check out. I just get ('OK', ['IDLE terminated (Success)']) every time. Here's the debug output for both cases: Timedout: 15:43.94 MainThread server IDLE started, timeout in 5.00 secs 15:48.94 imap.gmail.com handler

Expand width of shell in Python's IDLE

 ̄綄美尐妖づ 提交于 2019-12-09 13:19:16
问题 I'm new to python and I'm using Python's IDLE. Using numpy, I created a 24 x 24 matrix. I simply want to look at the matrix. I've maximized the shell on my monitor, so there's plenty of room to print the entire 24 columns' width, but it's only printing the first 13 columns of then continuing onto the next line to print the next 11 columns (had trouble in Stack Overflow copying and pasting what it's doing). The entire right half of the Shell window is blank (it's compressing everything to fit

Edit with IDLE (Python GUI) context menu on Windows 7

倖福魔咒の 提交于 2019-12-08 15:11:58
问题 Under Windows XP I have a context menu entry "edit with IDLE" for Python source files. I tried to make this work under Windows 7 (32 bit) as well by setting the corresponding registry entries under HKEY_LOCAL_MACHINE\SOFTWARE\.py\shellex\ContextMenuHandlers\ However without success - the context menu entry does not appear. How do I set a context menu entry for a specific file type in Windows 7? 回答1: I spent some time trying to figure this out, and finally got it. I'm running Windows 7, but it