python-idle

Implementing a backspace in Python 3.3.2 Shell using Idle

旧城冷巷雨未停 提交于 2019-11-28 02:22:00
There are several folks on here looking for backspace answers in Python. None of the questions I have searched have answered this for me, so here goes: The Simple Goal : be able to print out a status string on one line, where the next status overwrites the first. Similar to a % complete status, where instead of scrolling a long line of 1%\n, 2%, ... etc. we just overwrite the first line with the newest value. Now the question. When I type this in idle: print("a\bc") I get this as output: ac with what looks like an odd box with a circle between the 'a' and 'c'. The same thing happens when using

Carriage Return not working in IDLE?

落花浮王杯 提交于 2019-11-28 01:13:18
问题 I'm trying to create a code for a countdown timer that stays in place: so that each line overwrites the previous one. This is what I have so far: import time def countdown(t): while t: mins, secs = divmod(t, 60) timeformat = "{:02d}:{:02d}".format(mins, secs) print(timeformat, end='\r') time.sleep(1) t -= 1 print("That's the end! You lose...\n\n\n\n\n") exit() countdown(10) The output, however, is: 00:10 00:09 00:08 ... 00:00 That's the end! You lose... Why is the carriage return seemingly

DJANGO_SETTINGS_MODULE is undefined

独自空忆成欢 提交于 2019-11-28 01:03:04
问题 when i input from django.db import models into IDLE,the result throw a exception named Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined. why does this exception occur and how i can fix it 回答1: You can use python manage.py shell instead of using IDLE . manage.py reads and uses django settings including DJANGO_SETTINGS_MODULE . 回答2: Ensure, if not, follow the way to Quick Start: Assumptions: You have installed python on c:\ i.e., c:\python27 You have

“Edit with IDLE” option missing from context menu

北城以北 提交于 2019-11-27 22:22:21
I have Python 2.7.5 that installed with ArcGIS 10.2.2. When I first right-clicked a .py script I'd previously written it listed the "Edit with IDLE" option in the context menu. However, this option no longer appears when I right-click a .py file. I have read numerous threads concerning this issue and attempted some of them, such as modifying/removing registry keys and then reinstalling/repairing the software. I am not interested in using an IDE at this point, though many will be happy to know I intend to use an IDE later on. Right now, the purpose is to fix the problem rather than avoid and

Pasting multiple lines into IDLE

a 夏天 提交于 2019-11-27 21:53:54
Is there a way to paste a block of code into IDLE? Pasting line by line works, but sometimes I'd like to paste many lines at once. When I try, IDLE reads the first line and ignores the rest. >>> a = 1 b = 2 c = 3 >>> >>> a 1 >>> b Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> b NameError: name 'b' is not defined Probably not the most beautiful procedure, but this works: cmds = ''' paste your commands, followed by ''' : a = 1 b = 2 c = 3 ''' Then exec(cmds) will execute them. Or more directly, exec(''' then paste your commands, followed by ''') : a = 1 b = 2 c = 3 '

How do you add breakpoints to a Python program in IDLE?

折月煮酒 提交于 2019-11-27 21:50:53
I solved this already, I'm just posting it here because I couldn't figure it out with google, or by reading the docs. I only found it by accident. To add a breakpoint, right-click on the line that you want to add a breakpoint on and select "Set Breakpoint". The line will become highlighted. (Note that this only works when you are editing a file; it does not work at the interpreter.) This site has a detailed tutorial about using the IDLE debugger. On Mac, you need to Control-click instead of right clicking. There is an open Python issue about the lack of documentation for IDLE breakpoints .

Objective C: Get notifications about a user's idle state

旧城冷巷雨未停 提交于 2019-11-27 21:39:58
My cocoa app runs background tasks, which I would like to stop when the user becomes idle (no keyboard/mouse input) and then resume when the user becomes active again. Is there a way to register for idle-state notifications? In case you can't link to Carbon (ie. you want to compile x86_64 bit binary) you can wrap this function (which returns current idle time in seconds resolution as double - CFTimeInterval) in a timer: #include <IOKit/IOKitLib.h> CFTimeInterval CFDateGetIdleTimeInterval() { mach_port_t port; io_iterator_t iter; CFTypeRef value = kCFNull; uint64_t idle = 0;

How to start IDLE (Python editor) without using the shortcut on Windows Vista?

安稳与你 提交于 2019-11-27 19:58:26
I'm trying to teach Komodo to fire up IDLE when I hit the right keystrokes. I can use the exact path of the shortcut in start menu in the Windows Explorer location bar to launch IDLE so I was hoping Komodo would be able to use it as well. But, giving this path to Komodo causes it to say that 1 is returned. This appears to be a failure as IDLE doesn't start up. I thought I'd avoid the shortcut and just use the exact path. I go to the start menu, find the shortcut for IDLE, right click to look at the properties. The target is grayed out, but says "Python 2.5.2". The "Start in" is set to, "C:

Implementing a backspace in Python 3.3.2 Shell using Idle

若如初见. 提交于 2019-11-27 19:07:11
问题 There are several folks on here looking for backspace answers in Python. None of the questions I have searched have answered this for me, so here goes: The Simple Goal : be able to print out a status string on one line, where the next status overwrites the first. Similar to a % complete status, where instead of scrolling a long line of 1%\n, 2%, ... etc. we just overwrite the first line with the newest value. Now the question. When I type this in idle: print("a\bc") I get this as output: ac

Python IDLE subprocess error?

早过忘川 提交于 2019-11-27 17:59:36
问题 IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection. Don't think this has been asked-how come this comes up occasionally when running very simple programs-I then have to go to Task Manager & stop all Pythonw processes to get it to work again? It seems to happen randomnly on different bits of code-here is the one I'm doing at the moment- f = open('money.txt') currentmoney = float(f.readline()) print