Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7817819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:22:15+00:00 2026-06-02T06:22:15+00:00

Alright, im working on a project in Python, which is my first REAL Python

  • 0

Alright, im working on a project in Python, which is my first REAL Python project. Now, my problem: Graphics. I thought the simplist way would be Dwarf Fortress style graphics, were each tile is an ASCII colors letter. Now, I have a way to do this, but I think it would not be very efficient. This is my code:

import os
import time
import random
clear = lambda: os.system('clear')

g = '\033[32m' + '# '
t = '\033[31m' + '^ '
l = [g, g, g, g, g, g,
     g, g, g, g, g, g,
     g, g, g, g, g, g,
     g, g, g, g, g, g,
     g, g, g, g, g, g,
     g, g, g, g, g, g]

def level():
    i = 0
    while i < 1000:
        print l[0] + l[1] + l[2] + l[3] + l[4] + l[5]
        print l[6] + l[7] + l[8] + l[9] + l[10] + l[11]
        print l[12] + l[13] + l[14] + l[15] + l[16] + l[17]
        print l[18] + l[19] + l[20] + l[21] + l[22] + l[23]
        print l[24] + l[25] + l[26] + l[27] + l[28] + l[29]
        print l[30] + l[31] + l[32] + l[33] + l[34] + l[35]
        i += 1

        for b in l:
            ch = round(random.random())
            if ch:
                l[l.index(b)] = g
            else:
                l[l.index(b)] = t       
        clear()
level()

I got the clear thing from somewhere here on stack overflow, but it shouldn’t work on windows, considering on windows the clear command is ‘clr’ and on Mac and Linux, its ‘clear’. Helpature?

EDIT – ‘The problem is not the color, its the printing. Basically, how can I print it so I dont have to clear screen, how can I print it, and just change it, or something.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:22:17+00:00Added an answer on June 2, 2026 at 6:22 am

    As far as I’m aware all this kind of ASCII based terminal graphics manipulation stuff is usually done using the Curses library, so I recommend you try that.

    The documentation states that “The curses library keeps two data structures, one representing the current physical screen contents and a virtual screen representing the desired next state. The doupdate() ground updates the physical screen to match the virtual screen.” which seems to be exactly what you want. You just draw whatever you want into the virtual screen, and once you are ready, you call the curses.doupdate() function which updates the physical screen to match the virtual screen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, I need a sanity check. I was working on my project by starting
In my working folder of a VSS project, is it alright if I make
Alright, I'm at my wit's end on this issue. First, backstory. I'm working on
Alright so I'm working on a project where I want the app to check
Alright, now I am working on a small derp-ish game based on Brownian motion,
Alright, still working on a science project involving the testing of the speeds of
I've been working on a problem with a project for a while. Basically, I
Got the guestbook working alright. New messages are building up nicely. Now, only the
Alright, I am working on a small app which recursively deletes empty directories. I
I'm working on a Flash project right now and I am having to force

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.