72 Archived Topics
Remove Filter Using the wx.lib.pdfwin.PDFWindow one can read Adobe PDF files (.pdf) with wxPython. The PDF file format is popular document file format allowing mixing of text and graphics. The GUI toolkit wxPython's newer wx.activex module allows one to use the ActiveX control, as if it would be one wx.Window. It actually … | |
Does anybody have a good example of a Functor in Python? | |
A simple program to show you how to create a table of Fahrenheit and Celsius values using a for loop. You may be able to learn from this code. | |
This program uses Python module re for splitting a text file into words and removing some common punctuation marks. The word:frequency dictionary is then formed using try/except. In honor of 4th of July the text analyzed is National Anthem of USA (found via Google). | |
In my journey to find a new programing language to learn, I found Nimrod. According to the spiel on its web page: "Nimrod combines Lisp's power with Python's readability and C's performance." Just curious to know if anbody here has used it? Nimrod's home is at: http://nimrod-code.org/ | |
I was trying to come up with a dictionary of functions, but get it not to work. | |
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. | |
There seems to be many ways to create a dictionary, which one do you prefer? | |
This Python snippet shows you how to take typical beginner's example of prime number function and work on improving its speed. The decorator function for timing is ideal tool to follow your progress you make. The improvements are commented and you are encouraged to make further improvements. Python is fun! | |
Just curious how you got started. For me it was science class that used Python as the main tool. | |
[code]#Blast workbench using biopython from Bio.Blast import NCBIWWW ##result_handle = NCBIWWW.qblast("blastn", "nr", "8332116") fasta_string = "AATTCAGTGGCAAAAAAAAAACTCAAATTTTAGGGAAGGCCCTAATATTATCAAATAATTAGAGGGGGGG" result_handle = NCBIWWW.qblast("blastn", "nt", fasta_string) save_file = open("my_blast.xml", "w") save_file.write(result_handle.read()) save_file.close() result_handle.close() result_handle = open("my_blast.xml") from Bio.Blast import NCBIXML for record in NCBIXML.parse(open("my_blast.xml")) : #We want to ignore any queries with no search results: … | |
I am starting to play around with IronPython, but I can't figure out how to convert any code to executable file that will run on Windows. There has got to be some kind of batch file. | |
Many new computers come with Windows7(64bit) OS. You will be tempted to install something like Python 3.1.1 64bit version. However, many packages like PyQT and PyGame don't offer 64bit versions yet and will not work! | |
The Python module datetime allows you to calculate the days between two given dates with relative ease. I am using the US date format month/day/year, but you can change that by giving attention to the order of the extracted tuple. | |
The wxPython GUI toolkit has a nice numeric LED widget (LEDNumberCtrl from the wx.gizmos module) that is used here for displaying the current time in very visible 7 segment LED color display. It also shows the application of the time module and wx.Timer(). The code is simple as far as … | |
The FlashWindow component of wxPython will play those nice animated flash files found on the internet. They have file extension .swf usually. | |
The wxPython GUI tool makes it very simple to create nice looking analog clock. The analog clock component was put into simple dialog frame and can be moved about the screen. | |
Here we search a Python script file (or other text file) for one certain string, and copy any files containing this string to another folder. | |
Search for a file given its name and the starting search directory. The search is limited to a set depth of subdirectories. Python makes this easy to do. | |
This Python code will search for given filename starting with given directory. It will also search all the subdirectories in the given directory. The search will end at the first hit. | |
Code snippet to show you how to verify exit events from wxPython using dialog window. One event is from menu exit and the other from frame exit (x symbol in corner). | |
This short code shows how to indicate the mouse-over event on wxPython button, similar to the mouse-over in web pages. Button changes colour when mouse pointer is over its area. | |
The myth is around that while loop is faster than the corresponding for loop. I checked it out with Python module timeit, and came to surprising conclusion. This snippet can easily be modified to time any of your functions you write. | |
The program takes text and establishes dictionary of character:frequency. This dictionary is then presented sorted by character. Since it is important to show the most frequent characters, two methods are given to present dictionary sorted by frequency. Should all be very good for learning Python. | |
Do you think that people act demented during full moon nights? This small python program will tell you moon phase of a date you give it, so you can take precautions! | |
Question of wordcount program similar to Unix wc came up in the forum and I worked on a solution. Program shows number of lines, number of words, number of characters and text file's name. Good learning for commandline, file and string handling. | |
The little program allows eye patients to test their color skills. They are given a random color rectangle by the computer and are then asked to match the color as closely as they can using sliders of the three basic colors. An evaluation button examines the closeness of the results. | |
This program use a while loop to delete trailing spaces and tabs from a string. It is meant to be more of an example of the application of the while loop. | |
Commonly strings consist of ASCII characters, some are printable, some are in the backgrounds like the bell, carriage return, linefeed, tab and so forth. This code displays a table of ASCII characters and the corresponding decimal value. As always, you are encouraged to learn here. | |
Just a colorful ten second countdown to New Year. Hope you can learn some code from it. | |
My first experience with pointers. Learned how to spell a string foreward and backward using pointers. I hope you can learn too! | |
What is more efficient? 1) import math 2) from math import * 3) from math import sin, cos | |
Is there a good way to access browser like IE and run an HTML file from within Python code? | |
Is there a way to limit size of a list in Python, so it does not use all memory? | |
How do I best get a full display screen window using wxPython? | |
Decided to start my own thread rather than hijack thread "Sorting" I followed ghostdog74 advice and used module re to extract numeric strings: [php]import re data_raw = """[20] [ 35+ ] age = 40 (84) 100kg $245 """ # use regex module re to extract numeric string data_list = re.findall(r"\d+",data_raw) … | |
I read in the news that Python in going from version 2.4 to version 2.5 fixed 450 bugs. That seems to be lots of bugs! I used Python a lot and never found a single one of those bugs. What is your experience? | |
I wrote this little code to test a 2 dimensional array. Given the array array[row][col] I can find total_columns, but I am at loss to figure out total_rows. [code]// 2 D array #include <iostream> using namespace std; int main() { int row, col, total_columns; // two dimensional array in the … | |
Why is there a tuple and list in Python. They seemed to perform similar things. | |
I need to know how many times my function has been accessed in my program. Any suggestions other than global variable? | |
This small program is neat: [CODE]import calendar calendar.prmonth(2006, 3) """ March 2006 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 … | |
I am making progress learning Python. and English. I understands tuples, lists and dictionaries, but sets don't make muchly sense. Why use a set? What is a set good for? | |
I am trying things with wxStaticText (a label). I can chnage background colour, but not the text colour: [code]import wx class MyPanel(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self, parent, id) str1 = "Camembert cheese is the best!" self.label1 = wx.StaticText(self, -1, str1 , wx.Point(15, 30)) self.label2 = wx.StaticText(self, -1, str1 , … | |
The Internet has many animated GIF files, they are funny to watch. Does Python have a way to play those? I am asking to much? | |
A somewhat strange find in the Pyton Code Snippets here on this site. Is the BOO language very much like Python? It seems nice that one can compile and interpret the same language. Will it be worth to translate Python code to BOO just to get a nice small exe … | |
I did find the Python code snippet on PMIDI module here. It works fine and I have made some interesting sounds with it. Is there way to save this as sound file? | |
Is there a function in wxPython or anything that can creat a variable frequency sounds? | |
I want to creat file with each line having date + time + data so I can append more data as need be and know when it was added. What date+time function would be best? | |
I have run the slider demo that come with wxPython docs. It is rather stupid, as it puts slider on a panel using many unexplained numbers, never tells how to get position of slider or what to do next if the slider is moved. I am much lost, does anyone … |
The End.