Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Showing message on status bar

There's an empty space below app.title that we can
use as a status bar. So, I modify this recipe and
make it into a module. (need fgimage.pyd from here)
   1  
   2  # status.py
   3  from graphics import *
   4  import fgimage
   5  __all__ = ["status_on", "status_off"]
   6  
   7  bar = Image.new((119,13))
   8  bgcolor = screenshot().getpixel((0,0))[0]
   9  fg = fgimage.FGImage()
  10  
  11  def status_on(message=None):
  12      if message is not None:
  13          bar.clear(bgcolor)
  14          bar.text((0,11), unicode(message), 0xffffff)
  15      fg.set(57,30, bar._bitmapapi())
  16  
  17  def status_off():
  18      fg.unset()

You can use it easily this way
   1  
   2  >>> from status import *
   3  >>> status_on('Hello world')  # show it
   4  >>> status_off()              # hide it
   5  >>>

See a screenshot.
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS