Welcome to pyLottoSimu’s documentation!

Lotto Generator and Simulator

a simulation of Lotto Germany (pick 6 out of 49), Lotto Austria (pick 6 out of 45), EuroMillionen, Powerball Lottery US, Mega Millions lottery and Hot Lotto Sizzler system.

The pyLottoSimu program generates random lottery numbers and can simulate a draw. In the simulation view a Lotto Ball is visible on the numbers rotate faster and faster, and is finally available, this is the text, the first number of today’s draw was the … Maybe it was indeed actually the numbers of the next draw, of course are here, all the figures provided without guarantee.

pyLottoSimu can be started in these languages:

English, German, French, Spanish, Italian, Danish, Dutch, Polish and Russian

Start

The program requires Python 2.7 or 3.x and Qt5 for Python.

Start with:

python lotto.pyw [de|dk|fr|es|it|nl|pl|ru]

Documentation

Make the documentation as .html file:

cd docs
make html

Add new modules with:

cd docs
sphinx-apidoc -f -o . ../pylottosimu
_images/pyLottoSimu_screenshot_en.png

Contents:

Installation

Installing pyLottoSimu should usually be quite easy, as you can simply unpack and run pyLottoSimu in place if you wish to do so.

dependencies

You’ll need these dependencies to run the program:

  • python - The python programming language along with python-setuptools
  • pyQt5 - Qt5 for Python

build the help

code test

  • pep8 - Python style guide checker
  • pycodestyle - Python style guide checker
  • isort - import sorting and checking tool
  • nose - start nosetests to run the tests

version control system Git

  • Git - Git - distributed version control system

Installing Debian or Ubuntu

First you need to your computer these programs: Python, pyQt5 and version control system git:

# sudo apt-get install python python-pyqt5 python-pyqt5.qtsvg git
# sudo apt-get install python3 python3-pyqt5 python3-pyqt5.qtsvg git

Then you copied the source code of the program on your computer, either download the zip file of the project or download with the version control system:

# git clone https://github.com/MarkusHackspacher/pyLottoSimu.git

change the directory and run:

cd pyLottoSimu
./lotto.pyw

alternative:

python lotto.pyw [de|dk|fr|es|it|nl|pl|ru]
python3 lotto.pyw [de|dk|fr|es|it|nl|pl|ru]

Contribute

Feel free and send a pull request to https://github.com/MarkusHackspacher/pyLottoSimu . If you have an idea, tell it at https://gitter.im/MarkusHackspacher/pyLottoSimu . Thank you in advance.

Translate

GUI Translate

To translate the program or make a translation in your language, insert in the complete.pro your language code.

cd pylottosimu
pylupdate5 complete.pro

translate your language file: lotto1_xx.ts, and produce the .ts translation files with:

lrelease complete.pro

At Linux should you install the pyqt5-dev-tools to use the pylupdate5 command and qttools5-dev-tools for the lrelease:

apt-get install pyqt5-dev-tools qttools5-dev-tools

Documentation Translate

this documentation is in English and translated in German, generated by Sphinx.

Extract document’s translatable messages into pot files. As a result, many pot files are generated under _build/locale. With sphinx-intl command update the docs/locale/de directory:

cd docs
make gettext
sphinx-intl update -p _build/locale -l de

translate the .po files in ./locale/de/LC_MESSAGES/ and build mo files:

sphinx-intl build

To build local the docu in German:

make -e SPHINXOPTS="-D language='de'" html

History

Version

The current version is 1.7 from June 3, 2017.

Version 1.6.1

Version 1.6.1 from September 2, 2015.

Version 1.6

The version 1.6 from June 3, 2015 could be choose between four lottery systems, the German 6 out of 49 is default, the Austrian 6 out of 45 with a bonus number, the Euro 5 million from 50 with two Super numbers 1-11 and as well as the American Powerball Lottery 5 of 59 and a Bonus number in the range 1 to 35th Under the hood, the program logic of the surface is no longer dependent and it will in the next version also use the program without a graphical Enter surface. So the program structure is clearly arranged and it may be better to reuse parts of the program in other programs. Furthermore can be with Python tools create an .exe file:

python setup.py py2exe

If anyone would like to offer this program as a gimmick on his website, thereby adjusts the link to the homepage it can do like to feel free.

Version 1.5

The Version 1.5 from February 20, 2014, can be start with Qt4 or QT5.

Version 1.4

The renewals in Version 1.4 of October 3, 2013 from pyLottoSimu is multilingualism there are now nine languages. And in Program window there is a major change, it can now Select whether the number overview window to appear automatically after the draw.

Preview

The program starts with the last selected lotto system.

pylottosimu

pylottosimu package

Subpackages
pylottosimu.dialog package
Submodules
pylottosimu.dialog.lottosettingdialog module
class LottoSettingsDialog

Manage the GUI of setting dialog. Use lottosystem.ui.

class pylottosimu.dialog.lottosettingdialog.LottoSettingsDialog(sysdat, parent=None, testcase=None)[source]

Bases: PyQt5.QtWidgets.QDialog

The GUI of Settings.

Parameters:
  • sysdat (string) – Lotto setting
  • parent (string) – parent window
static get_values(sysdat, parent=None)[source]

static method to create the dialog and return (dialog.values, accepted)

Parameters:sysdat (string) – Lotto setting
Returns:dialog.values, accepted
Return type:array of int, bool
sep_addit_numbers()[source]

if the checkbox with separate additional numbers is active then enable to set the number

Returns:
set_values()[source]

Set Values

Returns:
values()[source]

Values

Returns:
with_addit()[source]

if the checkbox with additional numbers is active then enable to set the number

Returns:
pylottosimu.dialog.lottosettingdialog.qt_loadui(uifile)[source]
pylottosimu.dialog.show_drawing module
class DlgShowDrawing

show a Dialog with all the ball numbers from the draw and the bonus numbers.

class pylottosimu.dialog.show_drawing.DlgShowDrawing(ballnumbers, highestnumber, bonusnumbers=False, highestbonus=False)[source]

Bases: PyQt5.QtWidgets.QDialog

Show the numbers in a dialog box

Parameters:
  • ballnumbers (tuple of int) – the number of draw
  • highestnumber (int) – the number of the PushButtons
  • bonusnumbers (int) – the bonus numbers
  • highestbonus (int) – the highest bonus number (separate numbers)
Returns:

None

initbuttons()[source]

Array of buttons from 1 to the highest number and buttons for the additional numbers

Returns:None
Module contents

additional dialogs

Submodules
pylottosimu.lottosystem module
class pylottosimu.lottosystem.LottoSystemData[source]

Bases: object

loads predefined lottery systems. And read and write a json file of the data set.

Dataset:

  • name: name of the lottery system,
  • max_draw: highest number of draw
  • draw_numbers: number to pick
  • with_addit: with additional number
  • sep_addit_numbers: with separate additional number, the additional number are not in the same pot
  • addit_numbers: additional number to pick
  • max_addit: highest additional number in the separate pot
static fixdata()[source]

Data of predefined lottery system.

The following are predefined: Lotto Germany (pick 6 out of 49), Lotto Austria (pick 6 out of 45), EuroMillionen, Powerball Lottery US, Mega Millions, Hot Lotto Sizzler

If you miss your favorite lottery system than could you add here.

Returns:data
projectpath()[source]

open in the home path and create a direction.

Returns:path of the project
readfile()[source]

read lottosystems.json

Returns:data
writetofile()[source]

write lottosystems.json

Returns:none
pylottosimu.pylotto module
class LottoSimuDialog

Load the GUI and manage the signals for the program of the pyLottoSimu. Use the lottosimu_gui.ui

class drawlotto

simulate a lotto draw. draw the lotto numbers and give the draw text back

class pylottosimu.pylotto.DrawLotto(name='Lotto DE', max_draw=49, draw_numbers=6, with_addit=True, addit_numbers=1, sep_addit_numbers=True, max_addit=9, name_addition='Superzahl')[source]

Bases: PyQt5.QtCore.QObject

simulate a lotto draw

Parameters:
  • name (string) – name of game
  • max_draw (int) – maximal draw numbers
  • draw_numbers (int) – the draw numbers
  • with_addit (bool) – with additional number
  • addit_numbers (int) – the additional numbers
  • sep_addit_numbers (bool) – separates additional numbers
  • max_addit (int) – maximal additional numbers
draw()[source]

draw of the lotto numbers

Returns:none
picknumber(turn)[source]

pick of a lotto number

Returns:pick
class pylottosimu.pylotto.LottoSimuDialog[source]

Bases: PyQt5.QtWidgets.QMainWindow

The GUI and program of the pyLottoSimu.

action_lottosim()[source]

Changing the layout for simulation or generation and change the visible of the buttons.

Returns:none
onbtn_draw_overview()[source]

show dialog of the draw

Returns:none
onbtn_start()[source]

Start simulation with the first drawing init timer with the valve from the Scrollbar the next drawing starts with the timer event.

Returns:none
onclean_output_text()[source]

Clean the output text

Returns:none
onclose()[source]

Close the GUI

Returns:none
oninfo()[source]

Set the text for the info message box in html format

Returns:none
onrandom_numbers_generator()[source]

Show the output from the random number generator.

Returns:none
onsystem()[source]

show dialog of the draw

Returns:none
ontimer()[source]

Start time to show a number.

Returns:none
static onwebsite()[source]

Open website

Returns:none
show_next_number()[source]

Simulation of the draw and show the next Number on the Screen.

Returns:none
pylottosimu.pylotto.qt_loadui(uifile)[source]

load Qt ui file

Parameters:uifile
Returns:
Module contents

Manage a Lotto simulation draw.

tests package

Submodules
tests.test_drawlotto module
class tests.test_drawlotto.DrawLottoTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test the lotto draw with some input numbers

setUp()[source]

Init class pylotto.drawlotto

Returns:none
test_draw()[source]

test draw without a additional number

Returns:none
test_draw_addit()[source]

test draw with a additional number

Returns:none
test_draw_addit_sep()[source]

test draw with a separate additional number

Returns:none
test_drawone()[source]

test draw one number without a additional number

Returns:none
test_drawthree()[source]

test draw three number without a additional number

Returns:none
test_drawtwo()[source]

test draw two number without a additional number

Returns:none
test_drawzero()[source]

test set draw to no number and make sure to set to one number

Returns:none
test_setting()[source]

Test lotto.data

Returns:none
tests.test_lottosettingdialog module

Test the dialog module

lottosettingdialog

Setup for testing, create the UI_lottosystem.py file:

cd dialog/ pyuic4 –output UI_lottosystem.py lottosystem.ui
class tests.test_lottosettingdialog.LottoSystemDataTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test of drawing

setUp()[source]

Creates the QApplication instance

Returns:none
tearDown()[source]

Deletes the reference owned by self

Returns:none
test_dialog()[source]

test

tests.test_lottosystemdata module

Testcase for module pylottosimu.lottosystemdata

class tests.test_lottosystemdata.TestCodeFormat(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test the code format of the file

setUp()[source]

load LottoSystemData

Returns:
test_readfile()[source]

read the lottosystems.json file

tests.test_show_drawing module

Test the dialog module show_drawing

class tests.test_show_drawing.ShowDrawingTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

Test of drawing

setUp()[source]

Creates the QApplication instance

tearDown()[source]

Deletes the reference owned by self

test_ballnumber()[source]

test with one ball numbers

test_bonusnumbers()[source]

test ball numbers and bonus numbers in a maximal draw of 5 numbers

test_bonusnumbersseparate()[source]

test separate bonus numbers

Returns:none
test_highernumbers()[source]

test with higher draw numbers as the highest number in the draw in the ball numbers and in the bonus numbers

Returns:none
test_samenumbers()[source]

test the same ball numbers and bonus numbers in a maximal draw of 5 numbers

Returns:none
test_twoballnumber()[source]

test with two ball numbers

Module contents

test case

Indices and tables