Skip to content

pyhacks/idle-term

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

idle-term

This library provides some terminal features for IDLE's shell. Some features are:

  • "\b" and "\r" characters will be processed so progressbars which show information like progress percentage will finally work
  • print_fancy function can be used to print with color, font and style
  • clear function can be used to clear all outputs

Warning: The library isn't compatible with environments other than IDLE. Not even with the default shell of the system.

Installation

pip install idle-term

then you can import with

import idle_term

Escape Characters

Once you import the library, you don't have to do anything else and can immediately start using escape characters "\b", "\r", "\a" in your print and idle_term.print_fancy calls. These are the only escape characters supported. For things like colored output, use print_fancy.

Api Reference

function idle_term.print_fancy(*objects, sep = " ", end = "\n", **kwargs)

An alternative for the built in print function for printing with color, font and style. objects, sep and end parameters are for the same purpose as of the builtin print function.

kwargs will be passed to tag_config method of the tkinter.Text widget of IDLE's shell. You can find documentation about this method here. Parameters background and foreground accept a color value. You can find documentation about colors here. List of all predefined color names are here. A subset of those names can also be found in some 3rd party websites like this which also show the actual colors. If you want to use the font parameter, you must pass a tuple, tkinter.font.Font objects are not supported. You can get the list of all available font families by executing this code:

import tkinter.font
print(tkinter.font.families(tkinter.Tk()))

function idle_term.clear()

Clear the screen

function idle_term.paint_line(background = "", bgstipple = "")

Paint a line with the specified background color and stipple. Both parameters will be passed to tag_config method of the tkinter.Text widget of IDLE's shell. Read the second paragraph of the documentation of idle_term.print_fancy for more information about this method. If your program exits without printing anything else after calling this function, the painted line will be erased. In order to prevent this, you may print a space (" ") before exiting.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages