#1 Le 03/04/2021, à 17:36
- Compte supprimé
Sauver Fabien le Pendu de la potence! Jeu du pendu .
***** Ce message est édité pour une meilleure visibilité *****
Bonjour,
Afin d'étudier le mécanisme de portage de module via pip, j'ai écrit la lib fabienpendu, un jeu du pendu utilisant tkinter...
Ce jeu est libre de droit . En espérant que cette version du Pendu, vous plaise.
Merci à Joseph SARDIN pour les sons libres de droit que j'ai pioché sur son site: https://lasonotheque.org
Pour l'installer:
pip3 install fabienpendu
Si pip n'est pas encore installé sur votre PC :
sudo apt install python3-pip
Pour lancer le jeu:
python3
puis
>>> from fabienpendu_lib import pendu
>>> pendu()
ou tout simplement dans un terminal**:
$ pendu
** Si cela ne marche pas, il sera nécessaire d'indiquer le path dans le fichier .profil:
Dans ce cas copié collé à la fin du fichier $HOME/.profile le script ci dessous(merci Nany) :
# set PATH so it includes user's private lib if it exists
if [ -d "$HOME/.local/lib" ] ; then
PATH="$HOME/.local/lib:$PATH"
fi
Yapluka!
Dernière modification par Compte supprimé (Le 04/04/2021, à 20:51)
#2 Le 03/04/2021, à 18:10
- nany
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Bonjour,
** Pour cela il est necessaire d'ajouter le Path de la lib dans votre .bashrc:
export PATH=$PATH:~/.local/lib/
Plus proprement, je mettrais ça dans .profile en m’inspirant du code déjà présent :
# set PATH so it includes user's private lib if it exists
if [ -d "$HOME/.local/lib" ] ; then
PATH="$HOME/.local/lib:$PATH"
fi
Sur ce, je vais jouer un peu au pendu.
[edit]
pip install fabienpendu
pip3 install fabienpendu
Pour lancer le jeu:
>>> from fabienpendu_lib import pendu >>> pendu()
python3
from fabienpendu_lib import pendu
pendu()
Et pour sortir de python :
exit()
[/edit]
[re-edit]
C’est rigolo avec les sons et les animations.
[/re-edit]
Dernière modification par nany (Le 03/04/2021, à 18:24)
En ligne
#3 Le 03/04/2021, à 18:42
- Compte supprimé
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Bonjour Nany,
Merci pour tes précisions
pip3 install fabienpendu
En effet, selon l'implentation il faut pip3. Chez moi pip est installé via:
sudo apt install python3-pip
Ce qui renvoie à python3:
python3 -m pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
...
#4 Le 03/04/2021, à 18:45
- nany
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Chez moi :
┏[ samedi 03 avril 2021 ]
┣ nany@stupidcomputer :
┗▶ ~$ python3 -m pip --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
┏[ samedi 03 avril 2021 ]
┣ nany@stupidcomputer :
┗▶ ~$ pip install fabienpendu
La commande « pip » n'a pas été trouvée, mais il y en a 18 similaires.
┏[ samedi 03 avril 2021 ]
┣ nany@stupidcomputer :
┗▶ ~$
En ligne
#5 Le 03/04/2021, à 19:03
- Compte supprimé
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
ah oui. Il faut croire que nos pip sont installés différemment... Quelle est la version ton système?
à moins d'utiliser encore python2 qui est obsolète, je pense qu'il est préférable d'utiliser pip installé via sudo apt install python3-pip.
#6 Le 03/04/2021, à 19:21
- nany
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Quelle est la version ton système?
┏[ samedi 03 avril 2021 ]
┣ nany@stupidcomputer :
┗▶ ~$ lsb_release -r
Release: 20.04
┏[ samedi 03 avril 2021 ]
┣ nany@stupidcomputer :
┗▶ ~$ dpkg -l *python* | grep -Ev "^un"
Souhait=inconnU/Installé/suppRimé/Purgé/H=à garder
| État=Non/Installé/fichier-Config/dépaqUeté/échec-conFig/H=semi-installé/W=attend-traitement-déclenchements
|/ Err?=(aucune)/besoin Réinstallation (État,Err: majuscule=mauvais)
||/ Nom Version Architecture Description
+++-=============================-=========================-============-===============================================================================
ii hexchat-python3:amd64 2.14.3-3 amd64 Python 3 plugin for HexChat
ii libpython2-stdlib:amd64 2.7.17-2ubuntu4 amd64 interactive high-level object-oriented language (Python2)
ii libpython2.7-minimal:amd64 2.7.18-1~20.04.1 amd64 Minimal subset of the Python language (version 2.7)
ii libpython2.7-stdlib:amd64 2.7.18-1~20.04.1 amd64 Interactive high-level object-oriented language (standard library, version 2.7)
ii libpython3-dev:amd64 3.8.2-0ubuntu2 amd64 header files and a static library for Python (default)
ii libpython3-stdlib:amd64 3.8.2-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libpython3.8:amd64 3.8.5-1~20.04.2 amd64 Shared Python runtime library (version 3.8)
ii libpython3.8-dev:amd64 3.8.5-1~20.04.2 amd64 Header files and a static library for Python (v3.8)
ii libpython3.8-minimal:amd64 3.8.5-1~20.04.2 amd64 Minimal subset of the Python language (version 3.8)
ii libpython3.8-stdlib:amd64 3.8.5-1~20.04.2 amd64 Interactive high-level object-oriented language (standard library, version 3.8)
ii python-apt-common 2.0.0ubuntu0.20.04.4 all Python interface to libapt-pkg (locales)
ii python-dbus 1.2.16-1build1 amd64 simple interprocess messaging system (Python interface)
ii python-gi 3.36.0-1 amd64 Python 2.x bindings for gobject-introspection libraries
ii python-matplotlib-data 3.1.2-1ubuntu4 all Python based plotting system (data package)
ii python-pip-whl 20.0.2-5ubuntu1.1 all Python package installer
ii python-wxgtk3.0 3.0.2.0+dfsg-8build1 amd64 Python interface to the wxWidgets Cross-platform C++ GUI toolkit
ii python-wxversion 3.0.2.0+dfsg-8build1 all API for selecting the wxPython version to use
ii python2 2.7.17-2ubuntu4 amd64 interactive high-level object-oriented language (Python2 version)
ii python2-minimal 2.7.17-2ubuntu4 amd64 minimal subset of the Python2 language
ii python2.7 2.7.18-1~20.04.1 amd64 Interactive high-level object-oriented language (version 2.7)
ii python2.7-minimal 2.7.18-1~20.04.1 amd64 Minimal subset of the Python language (version 2.7)
ii python3 3.8.2-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii python3-apport 2.20.11-0ubuntu27.16 all Python 3 library for Apport crash report handling
ii python3-apt 2.0.0ubuntu0.20.04.4 amd64 Python 3 interface to libapt-pkg
ii python3-aptdaemon 1.1.1+bzr982-0ubuntu32.3 all Python 3 module for the server and client of aptdaemon
ii python3-aptdaemon.gtk3widgets 1.1.1+bzr982-0ubuntu32.3 all Python 3 GTK+ 3 widgets to run an aptdaemon client
ii python3-bcrypt 3.1.7-2ubuntu1 amd64 password hashing library for Python 3
ii python3-blinker 1.4+dfsg1-0.3ubuntu1 all fast, simple object-to-object and broadcast signaling library
ii python3-brlapi:amd64 6.0+dfsg-4ubuntu6 amd64 Braille display access via BRLTTY - Python3 bindings
ii python3-cairo:amd64 1.16.2-2ubuntu2 amd64 Python3 bindings for the Cairo vector graphics library
ii python3-certifi 2019.11.28-1 all root certificates for validating SSL certs and verifying TLS hosts (python3)
ii python3-cffi-backend 1.14.0-1build1 amd64 Foreign Function Interface for Python 3 calling C code - runtime
ii python3-chardet 3.0.4-4build1 all universal character encoding detector for Python3
ii python3-click 7.0-3 all Wrapper around optparse for command line utilities - Python 3.x
ii python3-colorama 0.4.3-1build1 all Cross-platform colored terminal text in Python - Python 3.x
ii python3-commandnotfound 20.04.4 all Python 3 bindings for command-not-found.
ii python3-crypto 2.6.1-13ubuntu2 amd64 cryptographic algorithms and protocols for Python 3
ii python3-cryptography 2.8-3ubuntu0.1 amd64 Python library exposing cryptographic recipes and primitives (Python 3)
ii python3-cups 1.9.73-3build1 amd64 Python3 bindings for CUPS
ii python3-cupshelpers 1.5.12-0ubuntu1.1 all Python utility modules around the CUPS printing system
ii python3-cycler 0.10.0-3 all composable kwarg iterator (Python 3)
ii python3-dateutil 2.7.3-3ubuntu1 all powerful extensions to the standard Python 3 datetime module
ii python3-dbus 1.2.16-1build1 amd64 simple interprocess messaging system (Python 3 interface)
ii python3-debconf 1.5.73 all interact with debconf from Python 3
ii python3-debian 0.1.36ubuntu1 all Python 3 modules to work with Debian-related data formats
ii python3-decorator 4.4.2-0ubuntu1 all simplify usage of Python decorators by programmers
ii python3-defer 1.0.6-2.1 all Small framework for asynchronous programming (Python 3)
ii python3-dev 3.8.2-0ubuntu2 amd64 header files and a static library for Python (default)
ii python3-distro 1.4.0-1 all Linux OS platform information API
ii python3-distro-info 0.23ubuntu1 all information about distributions' releases (Python 3 module)
ii python3-distupgrade 1:20.04.30 all manage release upgrades
ii python3-distutils 3.8.5-1~20.04.1 all distutils package for Python 3.x
ii python3-dnspython 1.16.0-1build1 all DNS toolkit for Python 3
ii python3-entrypoints 0.3-2ubuntu1 all Discover and load entry points from installed packages (Python 3)
ii python3-fasteners 0.14.1-2 all provides useful locks - Python 3.x
ii python3-future 0.18.2-2 all Clean single-source support for Python 3 and 2 - Python 3.x
ii python3-gdbm:amd64 3.8.5-1~20.04.1 amd64 GNU dbm database support for Python 3.x
ii python3-gi 3.36.0-1 amd64 Python 3 bindings for gobject-introspection libraries
ii python3-gi-cairo 3.36.0-1 amd64 Python 3 Cairo bindings for the GObject library
ii python3-gst-1.0 1.16.2-2 amd64 GStreamer GObject Introspection overrides for Python (Python 3)
ii python3-h5py 2.10.0-2build2 amd64 general-purpose Python interface to hdf5 (Python 3)
ii python3-httplib2 0.14.0-1ubuntu1 all comprehensive HTTP client library written for Python3
ii python3-ibus-1.0 1.5.22-2ubuntu2.1 all Intelligent Input Bus - introspection overrides for Python (Python 3)
ii python3-idna 2.8-1 all Python IDNA2008 (RFC 5891) handling (Python 3)
ii python3-jwt 1.7.1-2ubuntu2 all Python 3 implementation of JSON Web Token
ii python3-keras 2.2.4-1 all deep learning framework running on Theano or TensorFlow
ii python3-keras-applications 1.0.6-1 all popular models and pre-trained weights for the Keras deep learning framework
ii python3-keras-preprocessing 1.0.5-1 all data preprocessing module for the Keras deep learning framework
ii python3-keyring 18.0.1-2ubuntu1 all store and access your passwords safely - Python 3 version of the package
ii python3-kiwisolver 1.0.1-3build1 amd64 fast implementation of the Cassowary constraint solver - Python 3.X
ii python3-launchpadlib 1.10.13-1 all Launchpad web services client library (Python 3)
ii python3-lazr.restfulclient 0.14.2-2build1 all client for lazr.restful-based web services (Python 3)
ii python3-lazr.uri 1.0.3-4build1 all library for parsing, manipulating, and generating URIs
ii python3-ldb 2:2.0.10-0ubuntu0.20.04.3 amd64 Python 3 bindings for LDB
ii python3-lib2to3 3.8.5-1~20.04.1 all Interactive high-level object-oriented language (lib2to3)
ii python3-lockfile 1:0.12.2-2ubuntu2 all file locking library for Python — Python 3 library
ii python3-louis 3.12.0-3 all Python bindings for liblouis
ii python3-macaroonbakery 1.3.1-1 all Higher-level macaroon operations for Python 3
ii python3-mako 1.1.0+ds1-1ubuntu2 all fast and lightweight templating for the Python 3 platform
ii python3-markupsafe 1.1.0-1build2 amd64 HTML/XHTML/XML string library for Python 3
ii python3-matplotlib 3.1.2-1ubuntu4 amd64 Python based plotting system in a style similar to Matlab (Python 3)
ii python3-minimal 3.8.2-0ubuntu2 amd64 minimal subset of the Python language (default python3 version)
ii python3-mock 3.0.5-1build1 all Mocking and Testing Library (Python3 version)
ii python3-monotonic 1.5-0ubuntu2 all implementation of time.monotonic() - Python 3.x
ii python3-mpi4py 3.0.3-4build2 amd64 bindings of the Message Passing Interface (MPI) standard
ii python3-nacl 1.3.0-5 amd64 Python bindings to libsodium (Python 3)
ii python3-netifaces 0.10.4-1ubuntu4 amd64 portable network interface information - Python 3.x
ii python3-nose 1.3.7-5 all test discovery and running for Python3 unittest
ii python3-numpy 1:1.17.4-5ubuntu3 amd64 Fast array facility to the Python 3 language
ii python3-oauthlib 3.1.0-1ubuntu2 all generic, spec-compliant implementation of OAuth for Python3
ii python3-olefile 0.46-2 all Python module to read/write MS OLE2 files
ii python3-opencv 4.2.0+dfsg-5 amd64 Python 3 bindings for the computer vision library
ii python3-parameterized 0.7.0-2 all parameterized testing for Python 3
ii python3-paramiko 2.6.0-2 all Make ssh v2 connections (Python 3)
ii python3-pbr 5.4.5-0ubuntu1 all inject useful and sensible default behaviors into setuptools - Python 3.x
ii python3-pexpect 4.6.0-1build1 all Python 3 module for automating interactive applications
ii python3-pil:amd64 7.0.0-4ubuntu0.3 amd64 Python Imaging Library (Python3)
ii python3-pip 20.0.2-5ubuntu1.1 all Python package installer
ii python3-pkg-resources 45.2.0-1 all Package Discovery and Resource Access using pkg_resources
ii python3-problem-report 2.20.11-0ubuntu27.16 all Python 3 library to handle problem reports
ii python3-protobuf 3.6.1.3-2ubuntu5 amd64 Python 3 bindings for protocol buffers
ii python3-ptyprocess 0.6.0-1ubuntu1 all Run a subprocess in a pseudo terminal from Python 3
ii python3-pyatspi 2.36.0-1 all Assistive Technology Service Provider Interface - Python3 bindings
ii python3-pydot 1.4.1-3 all Python interface to Graphviz's dot (Python 3)
ii python3-pygame 1.9.6+dfsg-2build1 amd64 SDL bindings for games development (Python 3)
ii python3-pygpu 0.7.6-5build1 amd64 language bindings for libgpuarray (Python 3)
ii python3-pymacaroons 0.13.0-3 all Macaroon library for Python 3
ii python3-pyparsing 2.4.6-1 all alternative to creating and executing simple grammars - Python 3.x
ii python3-pyqt5 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5
ii python3-pyqt5.qtmultimedia 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's Multimedia module
ii python3-pyqt5.qtopengl 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's OpenGL module
ii python3-pyqt5.qtpositioning 5.14.1+dfsg-3build1 amd64 Python 3 bindings for QtPositioning module
ii python3-pyqt5.qtquick 5.14.1+dfsg-3build1 amd64 Python 3 bindings for QtQuick module
ii python3-pyqt5.qtsql 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's SQL module
ii python3-pyqt5.qtsvg 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's SVG module
ii python3-pyqt5.qtwebchannel 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's WebChannel module
ii python3-pyqt5.qtwebkit 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's WebKit module
ii python3-pyqt5.qtwebsockets 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's WebSockets module
ii python3-pyqt5.qtxmlpatterns 5.14.1+dfsg-3build1 amd64 Python 3 bindings for Qt5's XmlPatterns module
ii python3-qtpy 1.9.0-3 all abtraction layer for PySide/PyQt4/PyQt5 (Python 3)
ii python3-renderpm:amd64 3.5.34-1ubuntu1 amd64 python low level render interface
ii python3-reportlab 3.5.34-1ubuntu1 all ReportLab library to create PDF documents using Python3
ii python3-reportlab-accel:amd64 3.5.34-1ubuntu1 amd64 C coded extension accelerator for the ReportLab Toolkit
ii python3-requests 2.22.0-2ubuntu1 all elegant and simple HTTP library for Python3, built for human beings
ii python3-requests-unixsocket 0.2.0-2 all Use requests to talk HTTP via a UNIX domain socket - Python 3.x
ii python3-rfc3339 1.1-2 all parser and generator of RFC 3339-compliant timestamps (Python 3)
ii python3-samba 2:4.11.6+dfsg-0ubuntu1.6 amd64 Python 3 bindings for Samba
ii python3-scipy 1.3.3-3build1 amd64 scientific tools for Python 3
ii python3-secretstorage 2.3.1-2ubuntu1 all Python module for storing secrets - Python 3.x version
ii python3-setuptools 45.2.0-1 all Python3 Distutils Enhancements
ii python3-simplejson 3.16.0-2ubuntu2 amd64 simple, fast, extensible JSON encoder/decoder for Python 3.x
ii python3-sip 4.19.21+dfsg-1build1 amd64 Python 3/C++ bindings generator runtime library
ii python3-six 1.14.0-2 all Python 2 and 3 compatibility library (Python 3 interface)
ii python3-software-properties 0.98.9.4 all manage the repositories that you install software from
ii python3-speechd 0.9.1-4 all Python interface to Speech Dispatcher
ii python3-systemd 234-3build2 amd64 Python 3 bindings for systemd
ii python3-talloc:amd64 2.3.0-3ubuntu1 amd64 hierarchical pool based memory allocator - Python3 bindings
ii python3-tdb 1.4.2-3build1 amd64 Python3 bindings for TDB
ii python3-theano 1.0.4+dfsg-1build1 amd64 CPU/GPU math expression compiler for Python 3
ii python3-tk:amd64 3.8.5-1~20.04.1 amd64 Tkinter - Writing Tk applications with Python 3.x
ii python3-tz 2019.3-1 all Python3 version of the Olson timezone database
ii python3-uno 1:6.4.6-0ubuntu0.20.04.1 amd64 Python-UNO bridge
ii python3-update-manager 1:20.04.10.6 all python 3.x module for update-manager
ii python3-urllib3 1.25.8-2ubuntu0.1 all HTTP library with thread-safe connection pooling for Python3
ii python3-venv 3.8.2-0ubuntu2 amd64 pyvenv-3 binary for python3 (default python3 version)
ii python3-wadllib 1.3.3-3build1 all Python 3 library for navigating WADL files
ii python3-wheel 0.34.2-1 all built-package format for Python
ii python3-xdg 0.26-1ubuntu1 all Python 3 library to access freedesktop.org standards
ii python3-xkit 0.5.0ubuntu4 all library for the manipulation of xorg.conf files (Python 3)
ii python3-yaml 5.3.1-1 amd64 YAML parser and emitter for Python3
ii python3.8 3.8.5-1~20.04.2 amd64 Interactive high-level object-oriented language (version 3.8)
ii python3.8-dev 3.8.5-1~20.04.2 amd64 Header files and a static library for Python (v3.8)
ii python3.8-minimal 3.8.5-1~20.04.2 amd64 Minimal subset of the Python language (version 3.8)
ii python3.8-venv 3.8.5-1~20.04.2 amd64 Interactive high-level object-oriented language (pyvenv binary, version 3.8)
┏[ samedi 03 avril 2021 ]
┣ nany@stupidcomputer :
┗▶ ~$
Tiens, j’ai du python 2.7 installé. Ceci expliquerait peut-être cela.
J’ignore pourquoi il est installé, faut que je fouille dans mon historique.
En ligne
#7 Le 03/04/2021, à 19:54
- Compte supprimé
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Tiens, j’ai du python 2.7 installé. Ceci expliquerait peut-être cela.
J'en doute, j'ai les mêmes chez moi
Bref, pour ceux qui sont dans la même situation, utiliser pip3 si déjà présent comme nany.
Si vous rencontrez un souci, ou si vous avez des remarques n'hésitez pas à m'en faire part.
#8 Le 04/04/2021, à 09:38
- Compte supprimé
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Bonjour.
J'ai modifié le code afin qu'il soit écrit en pur python( j'utilisai une commande bash pour jouer le son). Le jeu devrait être maintenant portable sur l'ensemble des distributions utilisant python3...
J'ai aussi apporté une nouvelle fonctionnalité : Jouer avec des mots anglais .(il se peut que je dois modifier le contenu de ce dico. non testé...)
Pour jouer au pendu anglais(depuis un interprétateur python):
>>> from fabienpendu_lib import hanged
pygame 2.0.1 (SDL 2.0.14, Python 3.8.5)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> hanged()
ou bien depuis un terminal :
hanged
Dernière modification par Compte supprimé (Le 04/04/2021, à 20:54)
#9 Le 06/04/2021, à 12:16
- Compte supprimé
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Bonjour,
Tiens, j’ai du python 2.7 installé. Ceci expliquerait peut-être cela.
@nany: j'ai installé pip sur un ubuntu vierge et le comportement par défaut est le tien. Il faut utiliser pip3. J'ai édité la première page en conséquence.
Dernière modification par Compte supprimé (Le 06/04/2021, à 12:18)
#10 Le 06/04/2021, à 14:34
- lynn
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Bonjour,
Merci pour ce petit passe temps bien agréable. Ça fonctionne nickel sur Ubuntu 21.04.
«C'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!»
Coluche
Hors ligne
#11 Le 06/04/2021, à 14:50
- Nuliel
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Je viens de tester, ça fonctionne impec avec python 3.9
Hors ligne
#12 Le 07/04/2021, à 11:27
- Compte supprimé
Re : Sauver Fabien le Pendu de la potence! Jeu du pendu .
Merci de vos retours