Skip to main content

Cross-Platform Python Console I/O.

Project description

-----------

PyConio is a module that provides useful functions to work with console
I/O.

All the **PyConio** functions have the same behaviour of conio.h. And
best of all, is **Cross-Platform!**

This module is under the GNU GPLv2 license. See LICENSE to more details.

**Installing**
--------------

Execute this at your command prompt:

.. code-block:: bash

pip3 install https://gitlab.com/konniskatt/pyconio/raw/master/dist/pyconio-1.0.1.tar.gz

in administrator or sudo mode depending of your os.

*From source:*

Go to dist folder and there is a tarball file (pyconio_x.x.tar.gz):
Extract the folder that is inside in the tarball (.tar.gz), and then
execute:

.. code-block:: bash

python3 setup.py install

in **administrator** or **sudo** mode depending of your OS.

Instalación (spanish)
=====================

Ejecuta esto en la consola:

.. code-block:: bash

pip3 install https://gitlab.com/konniskatt/pyconio/raw/master/dist/pyconio-1.0.1.tar.gz

en modo **administrador** o **sudo**, dependiendo de tu SO.

*Desde fuente:*

Ve a la carpeta dist y ahi hay un archivo tarball (pyconio_x.x.tar.gz):
Extrae la carpeta que esta dentro del tarball (.tar.gz), y después
ejecuta:

.. code-block:: python

python3 setup.py install

en modo administrador o sudo, dependiendo de tu sistema operativo.

**Contributing**
-----------------

You can find PyConio in `GitLab`_, with contributing information.

.. _GitLab: https://gitlab.com/konniskatt/pyconio/

**Documentation**
-----------------

|colors|

Coloring text
=============

.. code-block:: python

from pyconio import *
textcolor(Red)
print("This text is in red!")
textbackground(Green) # Fore color maintains
print("This is a red text with green background!")


from pyconio import *
textcolor(Red)
textbackground(Green)
print("spam")
reversevideo()
# Now fore is green and background is Red
normvideo()
# Resets console to defaults

Note: When the program finishes, it reset colors.
Controlling cursor
position

.. code-block:: python

from pyconio import *
gotoxy(5, 5)
print("The cursor is now on x:5 and y:5")

Read keyboard
=============

.. code-block:: python

from pyconio import *
c = getch()
print("You pressed: %s" % c)

**getch():** Reads a key from keyboard and returns the pressed key.

**getche():** Reads a key from keyboard, returns the pressed key and
echoes it.

**getchar():** Reads one character from keyboard and returns the pressed
key, but waits until user press enter.

**kbhit():** Detects if a key was pressed, and returns True if was a key
pressed.

Micellaneous functions
======================

**Setting a title to console:**


.. code-block:: python

from pyconio import *
title("eggs")

**Pause program execution:**


.. code-block:: python

from pyconio import *
pause()
# Output: Press any key to continue . . .
# You can print your own message
pause("The program is paused")
# Output: This program is paused

**Hiding cursor and showing cursor:**


.. code-block:: python

from pyconio import *
hidecur() # The cursor is now hidden
showcur() # Now the cursor is not hidden

**Cleaning screen:**


.. code-block:: python

from pyconio import *
clrscr()

Examples
========

A *(very)* simple game using PyConio
|game|

.. |colors| image:: https://raw.githubusercontent.com/konniskatt/konniskatt.github.io/master/pyconio_colors.png

.. |game| image:: https://raw.githubusercontent.com/konniskatt/konniskatt.github.io/master/pyconio_demo.png

Keywords: pyconio colorama colors termcolor conio console cross-platform gotoxy
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Utilities
Classifier: Topic :: Terminals
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Programming Language :: Python :: 3
Classifier: Environment :: Console :: Win32 (MS Windows)Environment :: Console

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyconio-0.01.tar.gz (142.3 kB view details)

Uploaded Source

File details

Details for the file pyconio-0.01.tar.gz.

File metadata

  • Download URL: pyconio-0.01.tar.gz
  • Upload date:
  • Size: 142.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.6

File hashes

Hashes for pyconio-0.01.tar.gz
Algorithm Hash digest
SHA256 b88a79aa59d393dd95ff42ff3fb5ce8631754935e12c84928713d5ea22980868
MD5 6273560bfd7e2678b9f73dd4199730a6
BLAKE2b-256 1aad997ab99069c832038f5b197163fe9a4ce7a96d1f8b8ee730da7dc4bc52b3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page