Skip to main content

Form - 2.0

a class that allows you to edit text
it manages mouse insertion and some controls keys.


josmiley / Luke spywoker
(mutualaccount)
a class that allows you to edit text
it manages mouse insertion and some controls keys.

new version, completely rewritten
function 'ask' has become a 'class' for more flexibility and is now called Form.
sorry, not yet documented ...

Changes

new version, new concept
function 'ask' has become a 'class' for more flexibility and is now called Form.
The Form class has 3 attributes:
cursor = '|'
cursor_color = 150,150,150
font = font.Font (font.get_default_font (), 20)

and is defined as:
Form (POS, LENGTH, FONT = None, MAXLEN = 0, COLOR = (200,200,200))
POS <== (x, y)
LENGTH <== width in pix
FONT <== pygame.font object (Form.font default)
MAXLEN <== size of the string in characters 0 == unlimited
COLOR <== text color

Form object has 4 ATTRIBUTES:
RECTANGLE <== screen area that contains the text
FONT <== Font object
MAXLEN <== size of the string in characters 0 == unlimited

some properties:
INDEX <== reads and changes the cursor position
OUTPUT <== reads and modifies the text
CURSOR <== reads and changes the the character cursor
CURSOR_COLOR <== reads and changes the cursor color
COLOR <== reads and modifies the text color

and some methods:
clear(): clear OUTPUT
hide_cursor()
show_cursor()
init() : initializes the display, must be called at least once, and before update()
update(pygame.event) : must be called recursively

For the moment there is only one function provided:
sheet (Form sequence) ==> None

soon, more documentation and function

Links

Home Page
http://joel-murielle.perso.sfr.fr
Source
http://joel-murielle.perso.sfr.fr/ask.py

Releases

Form 3.2 — 21 Mar, 2011

Form 2.0 — 10 Mar, 2011

Form 2.1 — 11 Mar, 2011

Form 3.1 — 21 Mar, 2011

Form 4.0 — 29 Mar, 2011

Form 2.2 — 15 Mar, 2011

Form 3.0 — 20 Mar, 2011

Form 1.1 — 8 Jul, 2010

Form 1.0 — 5 Jul, 2010

Pygame.org account Comments

  • João Pedro Leôncio 2012-11-18 23:43

    Thank you, Josmiley. I plan to use this too. I made some modifications.
    Now, you can copy, paste and select all text.

    João Pedro Leôncio 2012-11-18 23:45

    Here is the link https://dl.dropbox.com/u/65353...