Python Forum
How to make curses.border() use A_BOLD atttribute?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make curses.border() use A_BOLD atttribute?
#1
For a window in a curses screen for which you want a box around the window border, one uses window.border() to populate the border.

However, there is no attribute argument available in the window.border() call, nor in the similar window.box() call.

I tried setting the border characters individually using window.chgat(y, x, num, curses.A_BOLD) but that changes the graphic used for the box characters to various bold letter characters instead of VLINE, HLINE, ULCORNER, etc.

Code fragment used to set the A_BOLD attribute only in the box characters follows.

boxmaxy, boxmaxx = winbox.getmaxyx()
winbox.border(0, 0, 0, 0, 0, 0, 0, 0)                 
winbox.chgat(0, 0, -1, curses.A_BOLD)                   
winbox.chgat(boxmaxy - 1, 0, -1, curses.A_BOLD)    
for _y in range(1, boxmaxy):                            
    winbox.chgat(_y, 0, 1, curses.A_BOLD)               
    winbox.chgat(_y, boxmaxx - 1, 1, curses.A_BOLD)
Box characters look like this on screen after trying to set A_BOLD. The characters are BOLD, but they are not the right VLINE, HLINE, etc. characters.

Output:
lqqqqqqqqqqqqqqqqqqqk x x x x x x mqqqqqqqqqqqqqqqqqqqj
Is there any way to accomplish setting a bold box border?

Environment is Win10-64, Python 3.8.5, console is a CMD.EXE window.

Also tried in a WIn10 Terminal window (Version: 1.5.10271.0) with identical results.

Peter

[Edit] Never mind, I figured it out. For the record, this code will bold the border but not the text inside of it:

winbox.attron(curses.A_BOLD)
winbox.border(0, 0, 0, 0, 0, 0, 0, 0)
winbox.attron(curses.A_NORMAL)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I want to be able to scroll up in curses to see previous text. Caiden 1 716 Jul-28-2023, 01:15 PM
Last Post: deanhystad
  curses issue otalado 2 2,684 Jun-29-2021, 02:07 PM
Last Post: tmz
  Curses script doesn't work wavic 1 4,066 Jan-08-2021, 09:11 PM
Last Post: wavic
  Why aren't all curses panel functions supported in python curses.panel? pjfarley3 2 2,617 Jul-22-2020, 11:08 PM
Last Post: pjfarley3
  Border detection Guzle03 2 5,803 May-25-2020, 08:40 PM
Last Post: Guzle03
  curses library autompav96 2 2,847 Mar-02-2019, 02:12 AM
Last Post: woooee
  curses key codes not working jgrillout 0 2,976 Feb-11-2019, 01:46 AM
Last Post: jgrillout
  Pretty table and curses? MuntyScruntfundle 0 2,850 Oct-16-2018, 10:22 AM
Last Post: MuntyScruntfundle
  Openpyxl_adding a thick border around outside of page pcsailor 1 2,722 Oct-13-2018, 01:15 AM
Last Post: pcsailor
  curses.initscr doesn't work zaphod424 3 9,694 Feb-28-2018, 12:36 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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