23 Reusable Code Snippet Topics
Remove Filter
|
|
A long standing complaint with the standard progress bar control is that there is no easy way to display text. In spite of numerous requests, Microsoft has not included this capability. The following code includes a class, `CustomProgress` which inherits the standard `ProgressBar` and adds such a feature. It is … |
|
Pretty neat text-based RPG that I made. Currently my first game. |
|
The Tkinter GUI toolkit comes with a scrolled text widget that is called ScrolledText. To get access to it you have to import it separately. It allows you to display large amounts of text in a small space. |
|
If you have a long message to display in a large readable font, then this little Tkinter GUI toolkit code might help. |
|
For a small class it doesn’t matter that much, but for a bigger class I find it handy to have an oversight of all the methods at hand. That’s what I did here. One requirement is that the class file has already been compiled error free. Don’t know if my … |
|
Just the very basics on how to draw a rotated text using the Python GUI toolkit PySide (public PyQt). Please experiment and embellish. |
|
I accidentally posted a lower version of the game that had more flaws, and a few less features. This one has a few more minor bugs fixed, and a power attack instead of a normal attack. |
|
This simple code shows how to write text with a given font, font size and color using the module pygame ... |
|
Here is simple text file example for beginners, using try..except for reading old content as it may not yet exist. |
|
Demonstrates the Right Hand Rule maze solving algorithm, with some sweet console colors and text display and erasing, in Windows. Note that if the Start is moved away from all the walls in the maze, the right hand rule fails, circling endlessly. Also, a similar failure happens if the Start … |
|
In today's environment where just about anyone can snoop around your e-mail, it is prudent to securely encrypt your more private writings. This little Python program will make it easier to do so. |
|
A somewhat newer look at Peter Parente's pywin32 based speech engine. It will read text on your computer. |
|
A little find and replace function for PHP, not tested, but theoretically should work. |
|
Upon resizing an anchored combobox - I noticed the text was always selected. This sparked the initiative to fix this problem. (Microsoft decided not to) So by extending the combobox class we can fix this. The following class can be dropped into a form for designer manipulation or as a … |
|
This shows the code for one simple crypt of text by swapping two adjoining characters each. You can make that more complex if you like. Can also be used for one nice riddle. |
|
Hi All, In my opinion, this is the best way to read in text from a csv file. Take for example if you are importing addresses: "1 Main Street","SmallTown","SmallCounty" The above is fine and easy to parse in BUT what if an address like this was entered: "App 1A, Tall … |
|
I wrote this program because I often am asked by people that know that I like to make games to make just a quick simple game for some reason or another. I always make a simple text based adventure game (like Zork, but simpler) and they are usually happy with … |
|
Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, … |
|
Aproach to the implementation of K-Nearest Neighbor (KNN) using the Euclidean algorithm. Sample Usage: [CODE]mywork = Words_Works() lit = 'literature.txt' mywork.add_category(lit, 'Literature') # adding files as category comp = 'computers.txt' mywork.add_category(comp, 'Computers') phy = 'physics.txt' mywork.add_category(phy, 'Physics') # saving categories dictionary to file mywork.save_categories() # can be loaded calling load_categories() … |
|
I made a PHP class that dramatically simplifies sending text messages with PHP. I know this isn't really a "help me out!" type question per se, but I would like to share the code because I have found it to be tremendously useful. You're free to do whatever you'd like … |
|
This is a very simple WYSIWYG Text editor that only has three options Bold, Italic, and Underline. just copy and paste on the page you want it on. it is really easy to add more features. ENJOY |
|
The code from my answer to thread: [url]http://www.daniweb.com/forums/thread292949.html[/url] Any field names with any same separator separating the values. This is straight text file reading routine, see the original thread for csv module based code. sample.dat: [CODE]id; name; email; homeaddress 123; gishi; gishi@mymail.com; 456 happy st. 345; tony; tony.veijalainen@somewhere.com; Espoo Finland … |
|
I used this pattern few times to answer a thread and thought to post it as snippet. |
The End.