I recently started learning to use Python and built in modules such as Tkinter. However in order to finish the programme I am making, I need to use pygame to open a music file in the programme. I have what I am sure is the correct pygame files (see image) but I have no clue how to actually add it to be able to use when coding in Python. (Get the error that the module cannot be found).
If there is an intergrated Python module that will allow me to open music files then I would be interested in knowing if that is an easier method.
Pygame files:
In a web browser go to http://www.pygame.org/download.shtml locate the package that matches your environment and follow the instructions, (either download and run or type the command).
Related
I'm doing a school project which requires us to create a database application. I decided to use Python, utilising the tkinter, openpyxl and Pillow modules. Whilst working on this at home, I was able to create a functioning program, but it has been extremely difficult to do any work on it at school due to the proxy preventing pip from being able to download openpyxl and Pillow.
Is it possible for me to get the modules from my computer (Mac) to school (Windows) and set it up there, and if so, how?
Windows installers are available here if that helps. But I'd agree that you should fix the proxy. Also check out the GitHub repository for Pillow.
You could always just pip at home, then go to <your python installation>\lib\site-packages and store the modules you got on a thumb drive. Take the drive to school and go to the same directory and place the files in site-packages. If you can't write to that directory, you could always place the modules alongside your modules and import them into your program.
Because you are on mac, it will be slightly different, but the path is very similar. Here's the official doc regarding:
https://docs.python.org/3.1/install/index.html#how-installation-works
I have spent weeks looking for a way to turn my webcam (built into the computer) into a QR scanner using Python but nothing has worked.
In the first instance, I tried installing this software which supposedly would allow me to turn my camera into a barcode scanner, which could then use this video to decode the codes in python. I installed the scanner along with 'pywin32' which was supposedly the library I needed to use, but I couldn't get the two to communicate as my computer kept saying that pywin32 has not been installed (although it had).
Then, I moved onto using zbar/ pyzbar. I downloaded all of the modules that were recommended (I followed the instructions set out on here) but these each came with several more error messages. It was all to do with various libraries and modules not being installed - I've tried downloading PIL/pillow, pyqrcode and a number of other things that are supposed to work, but for some reason, don't.
I don't feel that I can provide any evidence of code as I haven't got any code to fix for this particular issue -- I am simply looking for anyone who may know of a way to transform an ordinary webcam into a barcode/qr scanner using python.
Assuming none of the libraries I need are installed on my computer at the moment, could someone please explain to me exactly which libraries I will need to download, where I can find them, and how I could use them to make Python communicate with my webcam?
This is for my A Level Coursework and the scanner is absolutely fundamental to the program; if anyone can provide me with a useful, understandable solution then I would be really grateful. I apologise if this question is still a little too broad - I am a complete novice to coding and after searching endlessly for hours to find a solution, I feel that this is my final resort.
I did a project on zbar a couple of years ago, and it took 6 months to get zbar working :)
Here's how I setup zbar:
Zbar python module does require zbar.exe. Go to http://zbar.sourceforge.net/download.html and click either ZBar 0.10 Windows installer if you have windows, or Linux builds. Run zbar-0.10-setup.exe and follow installation instructions.
The Zbar python module is available on pypi. That means a simple pip install zbar will install it.
To get .py examples of Zbar running, first download the source code for zbar (top link on http://zbar.sourceforge.net/download.html ), unzip the tar.bz2 file (use 7zip). Inside the unzipped folder there should be /examples. Inside the folder, you will find several examples (proccessor.py is a good one), which can be run just as you would normally run a python program.
Recently I've been working on a project that involves a phone taking a picture, processing it in some way, and returning the output on the screen. In order to do this, I would have to use openCV, but when I try to "import cv2" in the Kivy code using the launcher, the app crashes immediately after I run it. I realize now that the reason this happens is because the Kivy launcher by itself can only do basic functions like print and such and there must be extra steps needed to use external libraries. I tried to use Buildozer to create a package for android, but soon found out that it only would work for linux computers, while I use Windows.
Essentially, my question is: Is there any way to include an external library in Kivy without using buildozer? And if there is, could you please describe it or post a link to a webpage that contains instructions(as I am fairly new to programming and am somewhat of a noob)
Thanks!
You can try python-for-android.
But the easiest way - install virtual box to your PC, download kivy/buildozer for VirtualBox( it calles Virtual Machine (for Android/buildozer)) here below: https://kivy.org/#download and then just connect downloaded vmdk-disk to VirtualBox, and then use this. Everything is prepared, you don't need to install kivy or buildozer.
You will spend about 30-40 minutes.
I am learning a course on Coursera: "An Introduction to Interactive Programming in Python".
I have written the whole of the code in the course in the browser and I have used a library called simplegui for all the GUI functionality.
I want to move this over to IDLE and then edit and work on it from there.
(I am also thinking of freezing the repository and then distributing it)
You can download this github repository.
simplegui tk Library
And then place the file with the CodeSkulptor code inside a .py file and add the line at the beginning of the code:
import simpleguitk as simplegui
And then you are all set to run this application. For most of the time, It works fine.
I have not yet checked it with sounds and images but I think you can get it to work with images too, in case it does not.
I thank the author of this library: GitHub User dholm for the amazing functionality he has given us.
First download the simplegui tk library as suggested above after that you also have to install a python3-tk package by using the command:
sudo-apt get install python3-tk
package after which you will easily able to run the program without using code sculptor.
I'm trying to use a game library called Cocos2d in python. However, I can't really import it. It's installed in one of python's lib directories, and when I import it, it's saying that it's not there. I know it has to do with pythonpath (provided in the IDE I'm using) but I'm not sure how to set it up. I've tried just adding the folder with cocos2d to the python path but it doesn't appear to work. The file's name is not cocos nor are there any files in the same directory with said name. Any suggestions?
Do you get an import error message ?
I don't know how you installed it but here are the steps I just did and which are working here.
Download cocos2d-0.4.0.zip from the official website
Extract it anywhere
Open a command-line in that folder
type python setup.py install
It even automatically installs pyglet.