Who even needs a window manager anyway

This commit is contained in:
Kenwood 2021-11-27 14:59:23 -05:00
parent d74b40b7e2
commit e89b964d27
2 changed files with 28 additions and 12 deletions

View File

@ -1,15 +1,30 @@
import urwid
import time
import logging
import verboselogs
import coloredlogs
verboselogs.install()
# Create a logger object.
logger = logging.getLogger(__name__)
# By default the install() function installs a handler on the root logger,
# this means that log messages from your code and log messages from the
# libraries that you use will all show up on the terminal.
coloredlogs.install(level='DEBUG')
def exit_on_q(key):
if key in ('q', 'Q'):
raise urwid.ExitMainLoop()
# If you don't want to see log messages from libraries, you can pass a
# specific logger object to the install() function. In this case only log
# messages originating from that logger will show up on the terminal.
coloredlogs.install(level='DEBUG', logger=logger)
logger.success('Program Started')
txt = urwid.BigText(u" Greatness Awaits... ", urwid.HalfBlock5x4Font())
test = urwid.Padding(txt, 'center', None)
test = urwid.Filler(test, 'middle', None, 7)
loop = urwid.MainLoop(test, unhandled_input=exit_on_q)
loop.run()
# Junk~
while True:
try:
logger.info('Nothing to do.')
time.sleep(1)
except KeyboardInterrupt:
break

View File

@ -1 +1,2 @@
urwid
coloredlogs
verboselogs