PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, August 15, 2022

[FIXED] How to add a console to a tkinter window

 August 15, 2022     console, output, python, tkinter     No comments   

Issue

I want a way to add a console to a tkinter window or redirect the output of the eval or exec functions to the maybe a uneditable text widget in tkinter. Also I want it so the code does not have to be saved first to get executed, I want it to be executed nevertheless. I have already viewed a few similar asked questions but have not understood what they do properly enough to implement it as I want myself to be able to customize it once I make it and not just copy down the code for it and use it. The official ipython console docs tell that ipython support qt and pyside but does not mention about tkinter(atleast till where I have seen).


Solution

I've tried this before. I found for myself the best way to do this is with a ListBox.

Here is a resource relating to ListBox: Python Tkinter Listbox

When I want to log something, I use the ListBox.insert(...) command so it gets stored in the list.

You can resize this list to either fit on the side or bottom of your program, just like a console.



Answered By - lime
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing