Menu

Home

Mayur Patel

A Simple Poker Tournament Clock

May 12 2012: initial release
May 21 2012: v1.1.0 Added "perfect-fit" banner resizing. Slow, but works.
May 25 2012: v1.1.1 Important threading bug fix. UI improvements.
May 28 2012: v1.1.2 Increase clock precision, reduce CPU load.
Jun 27 2012: v1.2.0 Sound on mac, linux, bsd. JPG & PNG support. Multi-proc image processing.
Jul 3 2012: v1.2.1 Image processing performance optimizations
Sep 14 2012: v1.3.0 python 2.7 support, better linux support, "normal" application window

License

This software copyright (c) 2012 by Mayur Patel
All Rights Reserved

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Nanojpeg and pyPNG are covered by their own licenses. See the py files included in this distribution for details.

Overview

I have written a simple poker tournament clock. This is written mostly with utility in mind, so there's no flashy graphics here.

Of particular interest is the ability to display banners occupying 40% of the available screen space. For poker leagues with active sponsorships, this allows sponsor ads to be displayed to members during the tournament. Ads are rotated periodically regardless of the status of the poker clock, so each sponsor has an equal amount of display time.

The software is written in python, so you will need to download python v3.2 or v2.7 to run it. The good news is that that's all you need. There are no other dependencies at this time. On some modern versions of linux, the tk library for python is not installed, even though this is a "standard" library in the python language. You might have to install the python-tk package yourself. Also, on linux, there seems to be spotty support for the OSS library used for sound support, so you may find that sound does not work immediately out of the box on linux.

You may use sound files in WAV format. A warning sound will play 60 seconds and again at 10 seconds before the end of a level. Another sound will play when a new level begins.

Installation

  1. Download python 2.7, python 3.2 or later and install on your target machine.
  2. Download the Simple Poker Tournament Clock package from Sourceforge.

If you are running on windows, you can double-click the file "tournament_clock.py" to start the software. On linux, run "python tournament_clock.py."

Creating a Tournament Structure XML

Before you can run the clock, you need to develop a tournament structure. In the download package, there are example tournament structures in the examples/structures directory. Hopefully, these are sufficiently clear you help you write your own. You can, of course, use one of the sample structure provided if you don't want to create your own.

In order to edit an XML file, you must use a text editor, such as Windows Notepad on Windows, or Emacs on linux. Do not use a word processor, as it may introduce formating that is not compatible with XML format.

At the top of the XML file, there are sections for specifying paths to sounds and banner graphics.

If you do not specify amount for the add-on stack and/or the rebuy stack, then these add-ons and/or rebuys will not appear on the tournament clock display.

Preparing Sound Files

In the tournament structure XML, paths to sound files are specified. In the given directory, the file "warning.wav" will play 60 seconds and 10 seconds before the end of a level. The file "newlevel.wav" will play when a new level begins. Sample WAV files are provided in the distribution, but you are encouraged to create your own WAV files to suit your needs.

Sound is supported on linux and bsd using OSS. On Mac, a sidecar process uses the system 'afplay' utility. On windows, the python-native sound module is used. Testing has been most extensively done on Windows, so please report errors with the other platforms.

I have found that converted mobile phone ringtones work well for the poker clock. You can find many free or no-fee ringtones online. In many cases, you will need to convert these from MP3 or MP4 to WAV before you can use them with the poker clock. There are online services that can do this for you if you do not have audio software. I cannot endorse any particular service; use them at your own risk. But here is one example. Here is another.

Preparing Banner Graphics

The poker clock supports PNG images, and many kinds of baseline JPG images. Specifically, it supports most kinds of PNG files, including those with an alpha channel. Files in JPG format must be non-progressive 24b RGB images encoded with YCbCr color. This covers most kinds of JPG, for example, those produced directly from digital cameras. If you have trouble with a particular JPG, we suggest you convert it to PNG. You may even find that PNG files load faster.

You can use the open source image editing package, GIMP, to convert images between formats.

There are some online services that can perform format conversions for you, if you do not have the necessary software. I cannot endorse any particular service, so use them at your own risk. Here is one example of a service. Here is another.

The ideal size of the banner graphics would be 90% of the width and 40% of the height of the resolution of the screen on your computer. In other words, if you computer can display 1280x800 pixels on the screen, then the ideal size for banner graphics will be 1152x400. Again, GIMP is a useful tool for resizing imagery and is available for a variety of platforms.

The tournament clock is intended to occupy as much of the screen as possible, so you are encouraged to maximize the tournament clock window, and leave it maximized during the course of the tournament. In versions previous to 1.3.0, the clock was full-frame, with no "decorations" on the window; but this caused problems on platforms other than windows. Having the clock in a "normal" window also makes it easier to move the clock between a first and second display, on computers that support them.

In the tournament structure XML, you should specify the directory containing your banner graphics. Any JPG or PNG files found in this directory will be queued for display, assuming there are no errors reading the files in question. If the files are too large or too small for the display, the software will attempt to resize the graphics.

Operating the Clock

On a platform supporting file associations, such as Windows, you can simply double-click the "tournament_clock.py" file to load and run it. You will immediately be asked to select the tournament structure XML.

After the banners are loaded, you will then be asked whether you wish to run a sound check. After this, the display will be filled and you will be able to begin the tournament. To begin the tournament, press the pause/play button to unpause the clock. Banners will change at the intervals specified in the tournament structure XML, regardless of whether or not the clock is running.

Buttons for the tournament director are situated on the right side of the screen. The typical selection of buttons are there, and they all do predictable things. The buttons most frequently used are likely to be "player out" which is the top-most button, and pause/play, which is the lowest button in the stack.

Also of note, is a time scrubber which spans the entire width of the screen and is located just above the banner graphics. As the clock ticks, the scrubber moves from left to right. There are buttons for the tournament director to jump to the next or previous levels, but within the level, the tournament director can click-drag the scrubber forward or backward. Clicking ahead of the scrubber bumps the clock forward by one second, behind the scrubber moves the clock back by one second.

Simple? I hope so.

The wiki uses Markdown syntax.

Project Admins: