2015-08-22 19:35:09

Hi,
Me and my friend Ethan have created a python module containing some functions that simplify such things as getting a random item from a list or checking if a number is even. The module is called useful beginner functions or ubf for short.
Here are all the functions:
numberinput(str): shows a standard prompt which you can do with raw_input(), but returns the number you type.
file_read(filename): returns the contents of a file.
file_write(filename,str): writes a string to a file. filename is obviously the file to write to, for example file.txt or something like that and str is the string to write to it.
listtostring(list): takes a list and converts it into a string.
listcon(list1,list2): puts 2 lists together into one list.
password(pwd,str): displays a prompt over and over again until the player gets the password right. Password is the password that is right, and str is the string to display when the prompt pops up, for example: Enter the password.
openurl(url): Opens a website in your default browser.
circum(r): Gets the circumference of a circle.
file_delete_contents(filename): Deletes the contents of a file.
is_even(number): Returns 1 or 0 depending on if a number is even or not.
randlist(list): returns a random item in a list. For example if you had a list containing the items apple, orrange, and bananna, it could return any one of those 3.
Those are all the functions. The link is: https://dl.dropboxusercontent.com/u/24767067/ubf.py

2015-08-23 05:37:43

hi
I have a question
My question is not about this topic, but how to compile my python programs into exe files?
Thanks

2015-08-23 10:05:53

Personally I use Pyinstaller, but you can also use Py2exe.

-BrushTone v1.3.3: Accessible Paint Tool
-AudiMesh3D v1.0.0: Accessible 3D Model Viewer

2015-08-23 10:52:45 (edited by dhruv 2015-08-23 10:53:25)

Be aware that if you intend to use q-continuum's or similar packages that need external dependencies, you need <package>.find_datafiles(). I know of a way to include these in py2exe, but i'm not sure if you can do it in pyinstaller. Most likely you can, however.

This is not a signature.

2015-08-24 04:47:22

Hello momo.
Yes pyinstaller or py2exe just be aware that using py2exe only gives you a windows executable. If you want to compile for windows mac and linux use pyinstaller. Basically use pyinstaller if you want your program to be cross-platform.

Guitarman.
What has been created in the laws of nature holds true in the laws of magic as well. Where there is light, there is darkness,  and where there is life, there is also death.
Aerodyne: first of the wizard order

2015-08-26 05:22:49

Hello,
You can also use CX_Freeze
At audiogames.net fan, awesome job, I don't even know how to open the URL... I think that you have everything you need to make a text adventure! Just use a while loop.