Questions tagged [python-idle]

IDLE is Python's Integrated Development and Learning Environment. It is part of the standard Python distribution.

IDLE is Python's Integrated Development and Learning Environment. It is part of the standard Python distribution. Though lightweight, it has a fairly rich feature set, including a code editor and a shell (in separate windows). It is written in Python using the tkinter toolkit.

1438 questions
17
votes
9 answers

Import module works in terminal but not in IDLE

I am trying to import pyodbc module on a windows computer. It works in the terminal, but not the IDLE. The error message in IDLE is: Traceback (most recent call last): File "FilePath/Filename.py", line 3, in import pyodbc …
Kuoso
  • 171
  • 1
  • 1
  • 3
16
votes
5 answers

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

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…
Jonas
  • 375
  • 2
  • 6
  • 20
15
votes
3 answers

Is there a way to configure the Application Pool's "Idle timeout" in web.config?

I know one can set the session timeout. But, if the application itself has received no requests for a given period of time, IIS shuts down the application. This behavior is configurable in the IIS management console, and I know how to do this.…
Martin Kool
  • 4,188
  • 4
  • 25
  • 36
14
votes
4 answers

How to reload Python module in IDLE?

I'm trying to understand how my workflow can work with Python and IDLE. Suppose I write a function: def hello(): print 'hello!' I save the file as greetings.py. Then in IDLE, I test the function: >>> from greetings import * >>>…
Eric Wilson
  • 57,719
  • 77
  • 200
  • 270
14
votes
4 answers

How to stop Python program execution in IDLE

I have a python script that uses plt.show() as it's last instruction. When it runs, IDLE just hangs after the last instruction. I get the image but I don't get the prompt back. On other scripts I typically use ctrl-c to break the program (sometimes…
greye
  • 8,921
  • 12
  • 41
  • 46
13
votes
5 answers

What code can I use to check if script is running in IDLE?

Just as the title says. I want to write a script that behaves differently depending on whether it's running inside a console window or in IDLE. Is there an object that exists only when running in IDLE that I can check for? An environment…
KeJi
  • 288
  • 2
  • 10
13
votes
1 answer

Different behavior in Python script and Python IDLE?

In the Python IDLE: >>> a=1.1 >>> b=1.1 >>> a is b False But when I put the code in a script and run it, I will get a different result: $cat t.py a=1.1 b=1.1 print a is b $python t.py True Why did this happen? I know that is compares the id of two…
WKPlus
  • 6,955
  • 2
  • 35
  • 53
12
votes
2 answers

Python Idle and KeyboardInterrupts

KeyboardInterrupts in Idle work for me 90% of the time, but I was wondering why they don't always work. In Idle, if I do import time time.sleep(10) and then attempt a KeyboardInterrupt using Ctrl+C, it does not interrupt the process until after…
cssndrx
  • 773
  • 2
  • 9
  • 17
12
votes
2 answers

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

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…
Tim
  • 151
  • 1
  • 1
  • 5
12
votes
6 answers

Start IDLE with Python 3 on Linux (Python 2.7 installed alongside)

I initially had Python 2.7, which often comes bundled with the OS (currently using Linux Mint 12). I wanted to try Python 3, so I installed it alongside Python 2. All is fine there, and I can run both versions in the terminal by calling either…
Samuel Tan
  • 1,700
  • 5
  • 22
  • 35
11
votes
2 answers

Can't run IDLE with pyenv installation: `Python may not be configured for Tk` `ModuleNotFoundError: No module named _tkinter'

I recently spent couple hours making tkinter and IDLE work on my pyenv Python installation (macOS). Why you are here? You manage Python versions with pyenv on macOS and ( You want IDLE - the development environment for Python - work on your…
nickolay
  • 3,643
  • 3
  • 32
  • 40
11
votes
2 answers

New line on error message in KeyError - Python 3.3

I am using Python 3.3 through the IDLE. While running a code that looks like: raise KeyError('This is a \n Line break') it outputs: Traceback (most recent call last): File "test.py", line 4, in raise KeyError('This is a \n Line…
Diego F Medina
  • 429
  • 3
  • 14
11
votes
2 answers

How do I unindent blocks of code in Python?

I am using Python 2.7.10 and am having trouble trying to unindent a block of code. Surely there is some sort of shortcut, instead of having to backspace every individual line? From the Python Shell, I opened a new file (.py) and that's where I am…
user5300247
11
votes
9 answers

Default working directory for Python IDLE?

Is there a configuration file where I can set its default working directory? It currently defaults to my home directory, but I want to set it to another directory when it starts. I know I can do "import os" followed by "os.chdir("")" but that's kind…
HaiXin Tie
  • 1,999
  • 3
  • 17
  • 14
11
votes
11 answers

Default save path for Python IDLE?

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?
rh0dium
  • 6,811
  • 4
  • 46
  • 79
1 2
3
95 96