Add more README.md for calculator, currency, minesweeper.
This commit is contained in:
11
calculator/README.md
Normal file
11
calculator/README.md
Normal file
@@ -0,0 +1,11 @@
|
||||
# Calculon - A desktop calculator in PyQt
|
||||
|
||||
A simple calculator application implemented in Python using PyQt. The UI was designed in Qt Designer and the
|
||||
calculator operations are implemented using simple stack-based logic.
|
||||
|
||||
!(Calculon)[screenshot-calculator.png]
|
||||
|
||||
> If you think this example app is neat and want to learn more about
|
||||
PyQt in general, [take a look at my ebook & online course
|
||||
"Create Simple GUI Applications"](https://martinfitzpatrick.name/create-simple-gui-applications)
|
||||
which covers everything you need to know to start building your own applications with PyQt.
|
||||
36
currency/README.md
Normal file
36
currency/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Doughnut — An exchange rate tracker for people nuts about dough, in PyQt.
|
||||
|
||||
This is a simple currency exchange rate tracker implemented in PyQt, using the [fixer.io](http://fixer.io) API
|
||||
for data. The default setup shows currency data for the preceding 180 days.
|
||||
|
||||

|
||||
|
||||
Data is loaded progressively, with increasing resolution. Currency rates for a given data are shown in the right
|
||||
hand panel and updated to follow the position of the mouse.
|
||||
|
||||

|
||||
|
||||
> If you think this example app is neat and want to learn more about
|
||||
PyQt in general, [take a look at my ebook & online course
|
||||
"Create Simple GUI Applications"](https://martinfitzpatrick.name/create-simple-gui-applications)
|
||||
which covers everything you need to know to start building your own applications with PyQt.
|
||||
|
||||
## Code notes
|
||||
|
||||
# Data handling
|
||||
|
||||
The interface presents a tracking plot (using PyQtGraph) of rates over the past 180 days. Since we don't want to
|
||||
spam a free service, requests to the API are rate-limited to 1-per-second, giving a full-data-load time of 180s (3 min).
|
||||
|
||||
To avoid waiting each time, we use `requests_cache` which uses a local sqlite database to store the result of recent
|
||||
requests. The requests for data use a progressive 'search' approach: where there is a gap in the data, the middle
|
||||
point is filled first, and it prefers to load the most recent timepoints first. This means the whole plot gradually
|
||||
increases in resolution over time, rather than working backwards only.
|
||||
|
||||
# Conversions
|
||||
|
||||
By default the app retrieves EUR rates and shows conversions to this base currency. If you change base currency
|
||||
it will retrieve all data again for that new currency. This is daft, since if we have rates vs. EUR we can calculate
|
||||
any other currency->currency conversion via EUR (with a potential loss of accuracy).
|
||||
|
||||
|
||||
36
minesweeper/README.md
Normal file
36
minesweeper/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Moonsweeper — A minesweeper clone, on a moon with aliens, in PyQt.
|
||||
|
||||
Explore the mysterious moon of Q'tee without getting too close to the alien natives!
|
||||
|
||||
Moonsweeper is a single-player puzzle video game. The objective of the game is to
|
||||
explore the area around your landed space rocket, without coming too close to the
|
||||
deadly B'ug aliens. Your trusty tricounter will tell you the number of B'ugs in the
|
||||
vicinity.
|
||||
|
||||

|
||||
|
||||
This a simple single-player exploration game modelled on _Minesweeper_
|
||||
where you must reveal all the tiles without hitting hidden mines.
|
||||
This implementation uses custom `QWidget` objects for the tiles, which
|
||||
individually hold their state as mines, status and the
|
||||
adjacent count of mines. In this version, the mines are replaced with
|
||||
alien bugs (B'ug) but they could just as easily be anything else.
|
||||
|
||||

|
||||
|
||||
> If you think this example app is neat and want to learn more about
|
||||
PyQt in general, [take a look at my ebook & online course
|
||||
"Create Simple GUI Applications"](https://martinfitzpatrick.name/create-simple-gui-applications)
|
||||
which covers everything you need to know to start building your own applications with PyQt.
|
||||
|
||||
## Code notes
|
||||
|
||||
### Cheating the first turn
|
||||
|
||||
In many *Minesweeper* variants the initial turn is considered a free
|
||||
go — if you hit a mine on the first click, it is moved somewhere else.
|
||||
Here we cheat a little bit by taking the first go for the player, ensuring that
|
||||
it is on a non-mine spot. This allows us not to worry about the bad first move
|
||||
which would require us to recalculate the adjacencies.
|
||||
We can explain this away as the "initial exploration around the rocket"
|
||||
and make it sound completely sensible.
|
||||
Reference in New Issue
Block a user