Example #1
0
 def __init__(self, font=FONT, colour="#FFFFFF",timeout=3, \
              offset=0, hoffset=0, shadow=0):
     self._osd = _pyosd.init(1)
     # attributes
     _pyosd.set_font(self._osd, font)
     _pyosd.set_colour(self._osd, colour)
     _pyosd.set_pos(self._osd, 2) # middle
     _pyosd.set_vertical_offset(self._osd, offset)
     _pyosd.set_horizontal_offset(self._osd, hoffset)
     _pyosd.set_shadow_offset(self._osd, shadow)
     _pyosd.set_align(self._osd, 1) # center
     _pyosd.set_timeout(self._osd, timeout)
     # save this as we won't have access to it on del
     self._deinit = _pyosd.deinit
Example #2
0
 def __init__(self, font=FONT, colour="#FFFFFF",timeout=3, \
              offset=0, hoffset=0, shadow=0):
     self._osd = _pyosd.init(1)
     # attributes
     _pyosd.set_font(self._osd, font)
     _pyosd.set_colour(self._osd, colour)
     _pyosd.set_pos(self._osd, 2)  # middle
     _pyosd.set_vertical_offset(self._osd, offset)
     _pyosd.set_horizontal_offset(self._osd, hoffset)
     _pyosd.set_shadow_offset(self._osd, shadow)
     _pyosd.set_align(self._osd, 1)  # center
     _pyosd.set_timeout(self._osd, timeout)
     # save this as we won't have access to it on del
     self._deinit = _pyosd.deinit
Example #3
0
    def __init__(self, font=default_font, colour="#FFFFFF",timeout=3, \
                 pos=POS_TOP, offset=0, hoffset=0, shadow=0,
                 align=ALIGN_LEFT, lines=2, noLocale=False):
        """ Initialise the OSD library.

        This must be done before display() will work. It will automatically
        deinit if necessary.

        font(pyosd.default_font): standard string-style X font description
        colour('#FFFFFF'): standard string-style X colour description
        timeout(3): number of seconds to remain on screen (-1 for infinite)
        pos(POS_TOP): position, one of POS_TOP or POS_BOT
        offset(0): vertical offset from pos
        shadow(0): black shadow size
        lines(2): the max number of lines available to display at once.
        noLocale(False): disable setlocale()

        In order to display foreign characters properly, pyosd calls
        setlocale() when a new object is created. If you are using
        threads in your application, or if you wish to set the locale
        yourself, pass noLocale=True, and use code like the following
        at the top of your application:

            import locale
            locale.setlocale(locale.LC_ALL, "")
        """

        self._osd = _pyosd.init(lines)
        # save this as we won't have access to it on del
        self._deinit = _pyosd.deinit

        self.set_font(font)
        self.set_colour(colour)
        self.set_pos(pos)
        self.set_vertical_offset(offset)
        self.set_horizontal_offset(hoffset)
        self.set_shadow_offset(shadow)

        self.set_align(align)
        self.set_timeout(timeout)

        # this should be safe to run on each object initialisation
        if not noLocale:
            import locale
            locale.setlocale(locale.LC_ALL, "")