python-idle

Delaying but not disabling iPhone auto-lock

☆樱花仙子☆ 提交于 2019-11-29 09:51:53
问题 I currently have a very simple app for which the only interaction is shaking the iPhone. However eventually the screen dims and auto-locks since the iPhone is not getting any touch events. I was wondering if there is a way to reset the auto-lock time-out when shaken? I know that to disable auto-lock completely I would do this: [[ UIApplication sharedApplication ] setIdleTimerDisabled: YES ] but I don't really want to disable it completely; if the iPhone is legitimately not being used it

DJANGO_SETTINGS_MODULE is undefined

落花浮王杯 提交于 2019-11-29 07:40:08
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 t-shimizu You can use python manage.py shell instead of using IDLE . manage.py reads and uses django settings including DJANGO_SETTINGS_MODULE . Vishal Bandre Ensure, if not, follow the way to Quick Start: Assumptions: You have installed python on c:\ i.e., c:\python27 You have installed Django 1.3 in same folder i.e., c:\python27 Step 1: First you need to set

Carriage Return not working in IDLE?

走远了吗. 提交于 2019-11-29 07:29:30
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 not working? IDLE doesn't support most control characters such as \r , \b . \r should work if you start

Python, writing multi line code in IDLE

為{幸葍}努か 提交于 2019-11-29 07:20:02
How do i write >>> x = int(raw_input("Please enter an integer: ")) >>> if x < 0: ... x = 0 ... print 'Negative changed to zero' ... elif x == 0: ... print 'Zero' ... elif x == 1: ... print 'Single' ... else: ... print 'More' ... this in IDLE. As soon as I hit enter after writting first line, it executes the first line and i am not able to write full code. I am very new to python, just started it today. Any help will be appreciated. Try File => New Window in top menu. Then write your code in this windows and run it by F5 key (or Run in top menu) 1: Use semicolons between lines 2: Try iPython 3:

Set Python IDLE as Default Program to Open .py Extensions [closed]

房东的猫 提交于 2019-11-29 07:06:25
I am on Windows 7 . I have Python 2.7.8 (64 bit) installed. Today, I changed the default program that opens .py files from IDLE to Windows Command Processor and stupidly selected the checkbox that said "always use the selected program to open this kind of file". What I want to do is change my default program back to IDLE. When I attempt to change it back to IDLE, I go to Control Panel\Programs\Default Programs\Set Associations and select the .py name and click Change Program. I do see python.exe but selecting that does nothing. I then use the "Browse" button to navigate to C:\Python27\Lib

Default save path for Python IDLE?

一曲冷凌霜 提交于 2019-11-29 06:50:18
Does anyone know where or how to set the default path/directory on saving python scripts prior to running? On a Mac it wants to save them in the top level ~/Documents directory . I would like to specify a real location. Any ideas? On OS X, if you launch IDLE.app (by double-clicking or using open(1) , for example), the default directory is hardwired to ~/Documents . If you want to change the default permanently, you'll need to edit the file idlemain.py within the IDLE.app application bundle; depending on which Python(s) you have installed, it will likely be in one of: /Applications/MacPython 2

How to get IDLE to accept paste of Unicode characters?

此生再无相见时 提交于 2019-11-29 05:15:05
Oftentimes when I'm working interactively in IDLE, I'd like to paste a Unicode string into the IDLE window. It appears to paste properly but generates an error immediately. It has no trouble displaying the same character on output. >>> c = u'ĉ' Unsupported characters in input >>> print u'\u0109' ĉ I suspect that the input window, like most Windows programs, uses UTF-16 internally and has no trouble dealing with the full Unicode set; the problem is that IDLE insists on coercing all input to the default mbcs code page, and anything not in that page gets rejected. Is there any way to configure or

Python IDLE subprocess error?

给你一囗甜甜゛ 提交于 2019-11-29 03:56:34
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(currentmoney, end='') howmuch = (float(input('How much did you put in or take out?:'))) now = currentmoney +

Is it possible to print a string at a certain screen position inside IDLE?

微笑、不失礼 提交于 2019-11-29 03:01:15
问题 EDIT: I just discovered that it's possible to obtain a similar behaviour by using the standard library "curses". There are some demonstrations about how it works here and there, for example on YouTube: http://www.youtube.com/watch?v=Bj-H9uPEa5U It's a strange and silly question I know, but I'm curious because I don't know that much about python and how it works. From the terminal or when you use IDLE, is there any way to print a string at a certain screen position? I'll try to explain this

Divide an image into 5x5 blocks in python and compute histogram for each block

ぃ、小莉子 提交于 2019-11-29 02:56:35
问题 Using Python, I have to: Divide a Test_Image and Reference_image into 5x5 blocks, Compute a histogram for each block, and compare it with the same block in the other image. For Example: image1(1,1) with image2(1,1) . Compare the similarity between two images (should be transform invariant). So far, I have calculated the histogram of the whole image using hist=numpy.histogram(image,bins=256) I want to divide an image, and later compute the histogram for all those blocks . I also want to use