• About
  • Privacy Policy
  • Disclaimer
  • Contact
Soft Bliss Academy
No Result
View All Result
  • Home
  • Artificial Intelligence
  • Software Development
  • Machine Learning
  • Research & Academia
  • Startups
  • Home
  • Artificial Intelligence
  • Software Development
  • Machine Learning
  • Research & Academia
  • Startups
Soft Bliss Academy
No Result
View All Result
Home Software Development

Python curses, Part 3: Working With Windowed Content

softbliss by softbliss
April 23, 2025
in Software Development
0
Python curses, Part 3: Working With Windowed Content
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter


# demo-clock.py

# These list assignments can be done on single lines, but it's much easier to see what
# these values represent by doing it this way.
space = [
"     ",
"     ",
"     ",
"     ",
"     ",
"     ",
"     ",
"     ",
"     ",
"     "]

colon = [
"     ",
"     ",
"  :::  ",
"  :::  ",
"     ",
"     ",
"  :::  ",
"  :::  ",
"     ",
"     "]

forwardSlash = [
"     ",
"    //",
"   // ",
"   // ",
"  //  ",
"  //  ",
" //   ",
" //   ",
"//    ",
"     "]

number0 = [
" 000000 ",
" 00  00 ",
" 00  00 ",
" 00  00 ",
" 00  00 ",
" 00  00 ",
" 00  00 ",
" 00  00 ",
" 00  00 ",
" 000000 "]

number1 = [
"  11  ",
"  111  ",
" 1111  ",
"  11  ",
"  11  ",
"  11  ",
"  11  ",
"  11  ",
"  11  ",
" 111111 "]

number2 = [
" 222222 ",
" 22  22 ",
" 22  22 ",
"   22  ",
"  22  ",
"  22   ",
" 22   ",
" 22    ",
" 22    ",
" 22222222 "]

number3 = [
" 333333 ",
" 33  33 ",
" 33  33 ",
"    33 ",
"  3333 ",
"    33 ",
"    33 ",
" 33  33 ",
" 33  33 ",
" 333333 "]

number4 = [
"   44  ",
"  444  ",
"  4444  ",
" 44 44  ",
" 44 44  ",
"444444444 ",
"   44  ",
"   44  ",
"   44  ",
"   44  "]

number5 = [
" 55555555 ",
" 55    ",
" 55    ",
" 55    ",
" 55555555 ",
"    55 ",
"    55 ",
"    55 ",
"    55 ",
" 55555555 "]

number6 = [
" 666666 ",
" 66  66 ",
" 66    ",
" 66    ",
" 6666666 ",
" 66  66 ",
" 66  66 ",
" 66  66 ",
" 66  66 ",
" 666666 "]

number7 = [
" 77777777 ",
"    77 ",
"   77 ",
"   77  ",
"  77  ",
"  77   ",
" 77   ",
" 77    ",
" 77    ",
" 77    "]

number8 = [
" 888888 ",
" 88  88 ",
" 88  88 ",
" 88  88 ",
" 888888 ",
" 88  88 ",
" 88  88 ",
" 88  88 ",
" 88  88 ",
" 888888 "]

number9 = [
" 999999 ",
" 99  99 ",
" 99  99 ",
" 99  99 ",
" 999999 ",
"    99 ",
"    99 ",
"    99 ",
" 99  99 ",
" 999999 "]

import curses
import math
import sys
import datetime

def putChar(windowObj, inChar, inAttr = 0):
 #windowObj.box()
 #windowObj.addstr(inChar)
 # The logic below maps the normal character input to a list which contains a "big"
 # representation of that character.
 charToPut = ""
 if '0' == inChar:
  charToPut = number0
 elif '1' == inChar:
  charToPut = number1
 elif '2' == inChar:
  charToPut = number2
 elif '3' == inChar:
  charToPut = number3
 elif '4' == inChar:
  charToPut = number4
 elif '5' == inChar:
  charToPut = number5
 elif '6' == inChar:
  charToPut = number6
 elif '7' == inChar:
  charToPut = number7
 elif '8' == inChar:
  charToPut = number8
 elif '9' == inChar:
  charToPut = number9
 elif ':' == inChar:
  charToPut = colon
 elif "https://dzone.com/" == inChar:
  charToPut = forwardSlash
 elif ' ' == inChar:
  charToPut = space

 lineCount = 0
 # This loop will iterate each line in the window to display a "line" of the digit
 # to be displayed.
 for line in charToPut:
  # Attributes, or the bitwise combinations of multiple attributes, are passed as-is
  # into addstr. Note that not all attributes, or combinations of attributes, will 
  # work with every terminal.
  windowObj.addstr(lineCount, 0, charToPut[lineCount], inAttr)
  lineCount = 1 + lineCount
 windowObj.refresh()

def main(argv):
  # Initialize the curses object.
  stdscr = curses.initscr()

  # Do not echo keys back to the client.
  curses.noecho()

  # Non-blocking or cbreak mode... do not wait for Enter key to be pressed.
  curses.cbreak()

  # Turn off blinking cursor
  curses.curs_set(False)

  # Enable color if we can...
  if curses.has_colors():
    curses.start_color()

  # Optional - Enable the keypad. This also decodes multi-byte key sequences
  # stdscr.keypad(True)

  caughtExceptions = ""
  try:
    # First things first, make sure we have enough room!
    if curses.COLS 
Tags: ContentcursesPartPythonWindowedWorking
Previous Post

How to counter people like Terrence Howard? • AI Blog

Next Post

When Your Toaster Outsmarts You: The Quiet Rise of AI, ChatGPT, and the Illusion of Magic | by EL JAZOULI | Apr, 2025

softbliss

softbliss

Related Posts

Spatial Computing Explained: Examples and Key Concepts
Software Development

Spatial Computing Explained: Examples and Key Concepts

by softbliss
June 17, 2025
Open Talent platforms emerging to match skilled workers to needs, study finds
Software Development

Open Talent platforms emerging to match skilled workers to needs, study finds

by softbliss
June 16, 2025
How to Play Grand Poo World 3
Software Development

How to Play Grand Poo World 3

by softbliss
June 16, 2025
Refactoring with Codemods to Automate API Changes
Software Development

Refactoring with Codemods to Automate API Changes

by softbliss
June 15, 2025
Scaling Finance with MS Dynamics 365 ERP
Software Development

Scaling Finance with MS Dynamics 365 ERP

by softbliss
June 15, 2025
Next Post
When Your Toaster Outsmarts You: The Quiet Rise of AI, ChatGPT, and the Illusion of Magic | by EL JAZOULI | Apr, 2025

When Your Toaster Outsmarts You: The Quiet Rise of AI, ChatGPT, and the Illusion of Magic | by EL JAZOULI | Apr, 2025

Premium Content

Unlock Business Growth with Expert Microsoft ERP Solutions

March 25, 2025
combining generative AI with live-action filmmaking

combining generative AI with live-action filmmaking

June 13, 2025
Sprinter Health raises $55M to expand its at-home healthcare service

Sprinter Health raises $55M to expand its at-home healthcare service

May 15, 2025

Browse by Category

  • Artificial Intelligence
  • Machine Learning
  • Research & Academia
  • Software Development
  • Startups

Browse by Tags

Amazon App Artificial Blog Build Building Business Coding Data Development Digital Framework Future Gemini Generative Google Growth Guide Innovation Intelligence Key Language Learning LLM LLMs Machine Microsoft MIT model Models News NVIDIA opinion OReilly Research Science Series Software Startup Startups Strategies students Tech Tools Video

Soft Bliss Academy

Welcome to SoftBliss Academy, your go-to source for the latest news, insights, and resources on Artificial Intelligence (AI), Software Development, Machine Learning, Startups, and Research & Academia. We are passionate about exploring the ever-evolving world of technology and providing valuable content for developers, AI enthusiasts, entrepreneurs, and anyone interested in the future of innovation.

Categories

  • Artificial Intelligence
  • Machine Learning
  • Research & Academia
  • Software Development
  • Startups

Recent Posts

  • Celebrating an academic-industry collaboration to advance vehicle technology | MIT News
  • Spatial Computing Explained: Examples and Key Concepts
  • What It Is and What Teachers Can

© 2025 https://softblissacademy.online/- All Rights Reserved

No Result
View All Result
  • Home
  • Artificial Intelligence
  • Software Development
  • Machine Learning
  • Research & Academia
  • Startups

© 2025 https://softblissacademy.online/- All Rights Reserved

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?