Game description: the user receives certain amount of money that he can easily dissipate making bets on horse races.
Purpose of the game: study of the Tkinter library with which it's quite simple to create modern program interface - not like all these characters and digits in the black background of the text editor, but full-fledged windows with cute buttons and menus.
Example of working with Tkinter:
from tkinter import *
root = Tk()
label1 = Label(root, text="HELLO, I AM TKINTER!", font="Consolas 20")
okButton = Button(root, text="OK", width="20", font="Consolas 10")
Not complicated, is it? If you worked with the previous sections attentively, you can edit the program right now, adding some buttons and changing the inscriptions. Cause everything in programming works by the same rules and in the same style!
The library is standard, that is, we don't have to download and install it.
What awaits us? There will be the main window of the program that allows to make a bet on a certain horse (or on some horses, or even on all of them); saving the sum to a file and loading it from there (just copying the previous functions); a message box that contains information about the weather, the day and the horses.
Since I draw badly even when I do my best, I took the images of the chess knights - let the horses be knights. All images are available for download, the link will be granted. The main window of the program:
Bets are made using the drop-down list of set values:
After the player has made a bet, he presses the "START" button, and horses run. There won't be movement animation (see the paragraph when I draw badly), the horses just move from left to right at different speeds. The speed is calculated according to the horse state and some random values:
Accidents are also included in the game, for example, when a horse may suddenly rush in the opposite direction. To implement this, we'll use special Tkinter tools like this:
...or something like that:
You can generate all these events in your own way, keeping the idea and extend its functionality. It will be fun, turn your imagination on! You can even joke
knock-knock normal jokes!
Good luck, friends! The horses are whinnying, the jockeys are nervously rubbing their hands, the bookmakers are greeting us with а friendly smile and expecting phenomenal profit... and it's time for us to delve into development!
© 2019-2021 Viktor Trofimov