Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8789171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:19:42+00:00 2026-06-13T22:19:42+00:00

I want to be able to push code into the IDLE shell history from

  • 0

I want to be able to push code into the IDLE shell history from a script such that

>>>somecode = """
def somefunc():
    pass
"""
>>>idlelib.some_unknown_add_to_history_method(somecode)
>>><ALT-p>

Results in:

>>>def somefunc():
    pass

So that I can edit and re-evaluate somefunc just as if I had manually pasted or entered the code into the shell. Is there an existing way to do this, or will I need to write an IDLE extension?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:19:43+00:00Added an answer on June 13, 2026 at 10:19 pm

    IDLE does not offer a way to insert an item into its shell history. You could change the code in PyShell.py.

    Take a look at the IdleX project for a lot of examples of IDLE extensions. There’s an extension for providing persistent history across IDLE sessions which might be a good starting point for writing your own extension. See PersistentHistory.py from that project.

    You might like its SubCode extension which allows you to edit and re-evaluate parts of your code directly from the editor by pressing Ctrl+Enter. You could also highlight code in the editor and run it by pressing F9.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to move the google analytics code into that database.
I want to be able to draw an array of balls, I can push
I want to be able to take an image that i have already captured
What's the best approach to incorporating code from a public repository into a private
We want to be able to push simple text messages to ALL our iphone
I want to write a function that slices a 'string' into a vector, sequentially,
vector<int> l; for(int i=0;i<10;i++){ l.push_back(i); } I want the vector to only be able
I'm using LaTeX and BibTeX for an article, and I want to able to
Want to be able to provide a search interface for a collection of objects
I want to be able to replicate only the folder structure (not the contents)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.