Found Poem Generator – Outputting Text To A Graphical Screen

Following on from my last post regarding the proposed additions to the ‘Found Poem’ Generator I started working on the list of enhancements with the aim of building the Found Poem Generator into something that could be used ‘out in the wild’ as a stand-alone art installation:

  1. Output the created poems to a larger screen ie a graphical type large fonted output rather than  using the console window.
  2. Provide two methods of running:
    1. Auto-generate a new poem every 5 minutes or so
    2. Provide buttons for user input to create poems on demand
  3. Package the program up to be self-contained 
  4. Deploy the program onto some sort of platform that wasn’t my Mac laptop ie a Raspberry PI and large screen monitor or TV
  5. Make the program auto-run when the device is started / restarted

Further enhancements could then be:

  1. Use a text / csv file to load in the words and lines of the poems rather than the hardcoded ones used currently
  2. Check the first letter of each line to capitalise it for poems and un-capitalise it for haikus, and add commas to the end of lines if they are missing or remove for haikus.

 

This post deals with number 1:

  1. Output the created poems to a larger screen ie a graphical type large fonted output rather than  using the console window.

The first task here was to identify a way of actually doing this, Python is a modular language where a lot of functions exist in external libraries that need to be added in to what ever you are writing. A search on the internet suggested Pygame or Tkinter might be the way to go. Pygame is a game development library whereas Tkinter is a GUI development library. Although neither jumps out as being ideal for simply outputting text to a large screen, Tkinter had the benefit of being built-in / pre-installed with Python so that was my first choice.

Another search on the internet, now looking for how to output text to a graphical screen using Tkinter, turned up a code snippet that I used to very quickly update the code to output to the graphical screen:

1-OutputToLargeScreen

As a proof of concept, this is working great for me at the moment, although there does seem to be some kind of bug or issue where the graphical screen doesn’t display or close properly. This appears to be a Mac specific issue, so I’m not too concerned at the moment as the project will ultimately be running on a Raspberry Pi, although I can foresee some more possible challenges with developing on a Mac and then porting to the Pi.

So onto the next stage now, providing buttons on the screen to allow prospective users to interact with the program and generate their own poems.

 

Source code for this update to the project can be downloaded here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s