python-idle

How to prevent python IDLE from restarting when running new script

余生颓废 提交于 2019-12-06 09:28:59
问题 I use Python 3.6.1 IDLE. I'd like to be able to run a sequence of scripts while maintaining the local environment (variables etc.) just as if I had entered all the commands line by line into the shell. However, whenever I execute a script the environment restarts and I lose all the variables from previous executions. Is there anything I can do to prevent this restart? I don't want to have to type things line by line in the shell. This question is similar to Run a module in IDLE (Python 3.4)

How to run a Python script from IDLE command line?

风流意气都作罢 提交于 2019-12-06 05:12:21
问题 In a bash shell, I can use 'bash ' or 'source ' to invoke a script by hand. Can I do the similar thing in the Python IDLE's interactive shell? I know I can go to File >> Open Module, then run it in a separate window, but that's troublesome. 回答1: One method I have found is execfile . It has the signature execfile(<filename>,<globals>,<locals>) and runs the file in the same thread as the current IDLE Session. This method is Python 2 specific The method the OP is asking for (in a different

Can I set IDLE to start Python 2.5 by default?

◇◆丶佛笑我妖孽 提交于 2019-12-06 04:44:46
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. 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 the name of the association: C:>assoc .py .py=Python.File Run regedit.exe . Browse to HKEY_CLASSES_ROOT

How to detect user inactivity in Qt?

末鹿安然 提交于 2019-12-06 02:49:42
问题 How can I detect user inactivity in a Qt QMainWindow? My idea so far is to have a QTimer that increments a counter, which, if a certain value is passed, locks the application. Any mouse or key interaction should set the timer back to 0. However I need to know how to properly handle input events which reset; I can re-implement: virtual void keyPressEvent(QKeyEvent *event) virtual void keyReleaseEvent(QKeyEvent *event) virtual void mouseDoubleClickEvent(QMouseEvent *event) virtual void

How do I use Numpy in Python IDLE?

ぃ、小莉子 提交于 2019-12-06 02:01:10
Variations of this question have been asked, but the answers always start from scratch (i.e. from installing numpy). I already have numpy installed on my computer from an earlier time when I downloaded Anaconda. If I try to install numpy again using pip install numpy , I get a long error like, the end of which looks like Command C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\users\\imray~1\\appdata\\local\\temp\\pip_build_Imray\\numpy\\setu p.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:

No IDLE for Python 3?

我怕爱的太早我们不能终老 提交于 2019-12-06 01:26:17
问题 I installed Python 3.1 yesterday on my Windows Vista PC, and was surprised to find that the version of IDLE is 2.6.4, for "Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32" I was hoping to use IDLE to investigate some of the new features of Python 3... I guess I'm stuck with the command line... Anyone know what's up with Python 3's IDLE? Thanks 回答1: Got it! I changed the Target of the shortcut to "c:\Python31\pythonw.exe" "c:\Python31\Lib\idlelib\idle.pyW"

Idle and Anaconda

跟風遠走 提交于 2019-12-06 00:08:36
问题 I use to have idle. Then I downloaded Anaconda and opened idle through there. I have not used idle for a while but just recently went to go open it up and use it again. However, it seems I no longer have idle on my computer, to my understanding I can still get to idle through Anaconda but I forgot how. Is there a way to open idle through Anaconda without re-downloading idle? If so what command can I use to pull Idle up? 回答1: You are looking for C:\... <\> ...Anaconda3\Lib\idlelib\idle.bat

how to detect idle user in iphone-sdk

泪湿孤枕 提交于 2019-12-05 21:45:37
In my Application I want to call Logout Function if user is idle for certain amount of time how to accomplish this answer doesn't work for me iPhone: Detecting user inactivity/idle time since last screen touch if i subclass my app delegate class from UIApplication and implement - (void)sendEvent:(UIEvent *)event It gives me error *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There can only be one UIApplication instance.' I can't find the other instance of UIApplication in my application so far i have done instead of @interface IdleAppDelegate :

“No display name” error when launching idle in cygwin

自作多情 提交于 2019-12-05 21:27:24
I am getting a "Tlc error: no display name...etc" when I try to open python scripts in idle using Cygwin. I type the following: idle python_script.py Do I need to install another Cygwin package to make this work? Windows 7- recently installed. Thanks!!:) Mariusz Jamro The error means that the program cannot find a display to show the window on. To solve that you need to install X Windows system and then set the display environment variable to: export DISPLAY=:0.0 See this answer for more details: https://stackoverflow.com/a/9418800/342473 来源: https://stackoverflow.com/questions/24845812/no

Configure IDLE to use Unicode

烂漫一生 提交于 2019-12-05 21:15:26
How do I make IDLE use UTF-8 as the default encoding for my Python files ? There is no "Encoding" option in IDLE settings. Just put special comment line at the beginning of the Python file: # -*- coding: utf8 -*- 1) Navigate to the folder with your current version of python. Mine is: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources 2) View the python application package, as this is the IDLE. 3) You should see a file called Info.plist containing the line- <?xml version="1.0" encoding="UTF-8"?> 4) Here you can modify the encoding, keep in mind python dose not support all source