Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
colouring strings
#22
(Oct-22-2019, 02:28 PM)jquast Wrote:
(Sep-22-2019, 09:07 AM)newbieAuggie2019 Wrote: I tried blessed and blessings (data further down). The author of blessings (last release: Jun‎ ‎21‎, ‎2018) is also the co-author of blessed (last release: Jun‎ ‎20‎, ‎2018). Blessed provides a demo program, written in some Python 2, that I managed to adapt to Python 3, but when I ran it, its output was with no formatting and with the following warning:

Error:
C:\Users\User1\AppData\Local\Programs\Python\Python37\lib\site-packages\blessed\terminal.py:32: UserWarning: One or more of the modules: 'termios', 'fcntl', and 'tty' are not found on your platform 'win32'. The following methods of Terminal are dummy/no-op unless a deriving class overrides them: setraw, cbreak, kbhit, height, width warnings.warn(_MSG_NOSUPPORT)

Hello, author of blessed here. We just merged windows support this past week, into release 1.16, so if you're still willing, please give it another try. You can do make terminal applications on windows if you are still interested. Sorry for the fork/confusion of blessings vs. blessed, I just had to make the best of having difficulty getting my changes, like keyboard support, accepted upstream into blessings, so the fork "blessed" has to continue.

Thanks for taking the time to contribute to my thread and to keep improving blessed.

blessed 1.15.0
https://pypi.org/project/blessed/
Last release: Jun‎ ‎20‎, ‎2018.‎

has changed to:

blessed 1.16.0
https://pypi.org/project/blessed/
Last released: Oct 18, 2019.

and still has issues (no formatting at all and the error message of AttributeError: 'NoneType' object has no attribute 'fileno'
on my Python 3.7.4 Shell and the error message of C:\Users\User1\AppData\Local\Programs\Python\Python37\lib\site-packages\blessed\terminal.py:222: UserWarning: Failed to setupterm(kind='cygwin'): Could not find terminal cygwin
.format(self._kind, err)
).

All the best,



AFTER POSTING HERE THE SUPPOSED CO-AUTHOR OF BLESSED, I TOOK THE TIME TO TEST THE VERSION I THOUGHT HE WAS REFERRING TO:

blessed 1.16.0
https://pypi.org/project/blessed/
Last released: Oct 18, 2019.

[Image: blessed-1-16-0-checked-on-Oct-22-2019.png]

BUT AFTER THAT, WHILE I WAS POSTING HERE TO SHARE MY CONCLUSIONS, I CHECKED THE LINK AND SAW THAT IT WAS AGAIN CHANGED:

blessed 1.16.1
https://pypi.org/project/blessed/
Last released: 20 minutes ago.

[Image: blessed-1-16-1-checked-on-Oct-22-2019-20...-later.png]

It would have been nicer to update the package, and THEN to share it on sites where it has been mentioned, and not the other way around ...



Well, after updating AGAIN the blessed package, I used this program to check its features:
# you_are_blessed_01.py
#

from blessed import Terminal

t = Terminal()

print(t.bold('Hi there!'))
print(t.bold_red_on_bright_green('It hurts my eyes!'))

with t.location(0, t.height - 1):
    print(t.center(t.blink('press any key to continue.')))

with t.cbreak():
    inp = t.inkey()
print('You pressed ' + repr(inp))

print('I am ' + t.bold('bold') + '!')
print('All your ' + t.red('base') + t.underline(' belongs to us now!'))
print('This should be ' + t.bold(t.red('bold')) + ' and red text.')
producing this error on my Python 3.7.4 Shell:
Error:
Traceback (most recent call last): File "C:\Users\User1\AppData\Local\Programs\Python\Python37\you_are_blessed_01.py", line 25, in <module> t = Terminal() File "C:\Users\User1\AppData\Local\Programs\Python\Python37\lib\site-packages\blessed\terminal.py", line 176, in __init__ self._keyboard_fd = sys.__stdin__.fileno() AttributeError: 'NoneType' object has no attribute 'fileno'
and no formatting at all and a user warning on Cmder:

Output:
D:\new downloads 28102017\cmder λ you_are_blessed_01.py
Error:
C:\Users\User1\AppData\Local\Programs\Python\Python37\lib\site-packages\blessed\terminal.py:222: UserWarning: Failed to setupterm(kind='cygwin'): Could not find terminal cygwin .format(self._kind, err)) Hi there! It hurts my eyes! press any key to continue. You pressed 'b' I am bold! All your base belongs to us now! This should be bold and red text.
When I tried to run this other program:

# you_are_blessed_03.py
#
#

from blessed import Terminal

term = Terminal()
with term.location(0, term.height - 1):
    print('This is' + term.underline('underlined') + '!')
the same error and warning messages appeared and no formatting both on Python 3.7.4 Shell and Cmder.

All the best,
newbieAuggie2019

"That's been one of my mantras - focus and simplicity. Simple can be harder than complex: You have to work hard to get your thinking clean to make it simple. But it's worth it in the end because once you get there, you can move mountains."
Steve Jobs
Reply


Messages In This Thread
colouring strings - by newbieAuggie2019 - Sep-17-2019, 03:06 AM
RE: colouring strings - by wavic - Sep-17-2019, 03:14 AM
RE: colouring strings - by newbieAuggie2019 - Sep-17-2019, 04:23 PM
RE: colouring strings - by snippsat - Sep-17-2019, 04:42 PM
RE: colouring strings - by newbieAuggie2019 - Sep-17-2019, 09:46 PM
RE: colouring strings - by newbieAuggie2019 - Sep-17-2019, 04:48 PM
RE: colouring strings - by snippsat - Sep-17-2019, 05:13 PM
RE: colouring strings - by newbieAuggie2019 - Sep-17-2019, 05:37 PM
RE: colouring strings - by snippsat - Sep-17-2019, 06:22 PM
RE: colouring strings - by wavic - Sep-17-2019, 08:50 PM
RE: colouring strings - by snippsat - Sep-17-2019, 10:11 PM
RE: colouring strings - by newbieAuggie2019 - Sep-20-2019, 07:27 AM
RE: colouring strings - by wavic - Sep-18-2019, 08:25 AM
RE: colouring strings - by wavic - Sep-18-2019, 11:10 AM
RE: colouring strings - by newbieAuggie2019 - Sep-20-2019, 06:34 PM
RE: colouring strings - by newbieAuggie2019 - Sep-22-2019, 07:12 AM
RE: colouring strings - by newbieAuggie2019 - Sep-22-2019, 09:07 AM
RE: colouring strings - by jquast - Oct-22-2019, 02:28 PM
RE: colouring strings - by newbieAuggie2019 - Oct-22-2019, 03:31 PM
RE: colouring strings - by newbieAuggie2019 - Sep-24-2019, 10:42 AM
RE: colouring strings - by wavic - Sep-24-2019, 01:28 PM
RE: colouring strings - by newbieAuggie2019 - Sep-30-2019, 08:20 PM
RE: colouring strings - by jquast - Oct-23-2019, 03:44 AM
RE: colouring strings - by newbieAuggie2019 - Oct-23-2019, 08:59 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand strings and lists of strings Konstantin23 2 817 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 1,818 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  Finding multiple strings between the two same strings Slither 1 2,547 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  lists, strings, and byte strings Skaperen 2 4,265 Mar-02-2018, 02:12 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020