basicprogramming.org


Welcome, Guest. Please login or register.
Did you miss your activation email?
Forum time; Mar 12. 2010, 05:14
Home Help Search Calendar Login Register
News: Old bloggin: The Noob’S Robot Slave And How To Reactivate It by: Hartnell

+  BASIC programming forum
|-+  Basic Coding
| |-+  Other programming languages.
| | |-+  (python) welcome to puppy linux
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Reply Print
Author Topic: (python) welcome to puppy linux  (Read 75 times)
menn
Hero Member
*****
Offline Offline

Posts: 571


« on: Sep 25. 2009, 13:45 » Reply with quote

i originally did this as a wxbasicscript ("puppybasic") demo, using ansi codes for color "ascii" art. (ansi art.) i haven't used wxbasicscript in years, this version in python uses ansi codes too. i was originally of the impression that while idle (the standard python gui ide) does not display ansi, it will display curses screens. having tried idle, i can't seem to get it to do any kind of colored text... simply calling python as a script (the way i usually develop and test python scripts) would seem to be the best way to do either ansi or curses programs.

Code:
#!/usr/bin/env python
#public domain

q =     "                                                          "
q = q + "         ****************                                 "
q = q + "     ************************                             "
q = q + "    **************************                            "
q = q + "    ** ******************** **                            "
q = q + "       ****  ********  ****                               "
q = q + "       ***  ` ******  ` ***       Welcome to Puppy Linux! "
q = q + "        ***  ********  ****                               "
q = q + "        ******************                                "
q = q + "         ****************                                 "
q = q + "          *****(   *****                                  "
q = q + "           ***(     ***                                   "
q = q + "            ***(   ***                                    "
q = q + "              ******                                      "
q = q + "                                                          "

c = 0
print chr(27) + "[1;37;40m"
for n in range (len(q)):

    x = " 12345*`(".find(q[n])

    if x < 0:
        if c <> 0: print "\x08" + chr(27) + "[1;37;40m",
        c = 0
    elif x == 0:
        if c <> 0: print "\x08" + chr(27) + "[1;30;40m",
        c = 0
    elif x == 6:
        if c <> 6: print "\x08" + chr(27) + "[1;37;43m",
        c = 6
    elif x == 7 or x == 8:
        if c <> 7: print "\x08" + chr(27) + "[1;37;47m",
        c = 7
               
    if x == -1: print "\x08" + chr(27) + "[1;37;40m",
    if x != -1: print "\x08" + " ", 
    if x == -1: print "\x08" + q[n],

    if float(n) / 58 == int(n / 58): print ""

print chr(27) + "[0;37;40m"
print ""
Report to moderator   Logged

an "all purpose" language calls for- as much as can possibly be reasonable- an "all purpose" forum. the worst thing happening to modern basic? too many pointless rules and painting everything into corners. most modern basic forums are like that too.
Pages: [1] Go Up Reply Print 
« previous next »
Jump to:  
Atom RDF RSS 0.91 RSS 2.0


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!