August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
Displays text in pygame a word at a time as a 'ticker'.
NOTE: This component is very much a work in progress. Its capabilities and API is likely to change substantially in the near future.
Ticker displaying text from a file:
Pipeline( RateControlledFileReader("textfile","lines",rate=1000),
Ticker(position=(100,100))
).run()
The component requests a display surface from the Pygame Display service component. This is used as the ticker.
Send strings containing lines of text to the Ticker component. Do not send strings with words split between one string and the next. It displays the words as a 'ticker' one word at a time. Text is automatically wrapped from one line to the next. Once the bottom of the ticker is reached, the text automatically jump-scrolls up a line to make more room.
The text is normalised by the ticker. Multiple spaces between words are collapsed to a single space. Linefeeds are ignored.
NOTE: 2 consecutive linefeeds currently results in a special message being sent out of the "_displaysignal" outbox. This is work-in-progress aimed at new features. It is only documented here for completeness and should not be relied upon.
You can set the text size, colour and line spacing. You can also set the background colour, outline (border) colour and width. You can also specify the size and position of the ticker
NOTE: Specifying the outline width currently does not work for any value other than 1.
NOTE: Specify the size of the ticker with the render_right and render_bottom arguments. Specifying render_left and render_top arguments with values other than 1 results in parts of the ticker being obscured.
The ticker displays words at a constant rate - it self regulates its display speed.
Whilst it is running, sending any message to the "pausebox" inbox will pause the Ticker. It will continue to buffer incoming text. Any message sent to the "unpausebox" inbox will cause the Ticker to resume.
Whilst running, you can change the transparency of the ticker by sending a value to the "alphacontrol" inbox between 0 (fully transparent) and 255 (fully opaque) inclusive.
If a producerFinished message is received on the "control" inbox, this component will send its own producerFinished message to the "signal" outbox and will terminate.
However, if the ticker is paused (message sent to "pausebox" inbox) then the component will ignore messages on its "control" inbox until it is unpaused by sending a message to its "unpausebox" inbox.
Ticker(...) -> new Ticker component.
A pygame based component that displays incoming text as a ticker.
Keyword arguments (all optional):
NOTE: render_left and render_top currently behave incorrectly if not set to 1
Warning!
You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers.
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Clears the ticker of any existing text.
Main loop.
Draws a rectangle to form the 'border' of the ticker
Generator. Gets a display surface from the Pygame Display service.
Makes the request, then yields 1 until a display surface is returned.
Generator. yields 1 until data ready on the named inbox.
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT