15,175 Topics

Member Avatar for
Member Avatar for a1eio

For more information on threading read this [B]excellent[/B] 4 page tutorial: [URL="http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/"]http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/[/URL]

0
394
Member Avatar for vegaseat

Text to speech can be implemented in its simplest form using Microsoft's Component Object Model (COM) connecting to the Speech API (SAPI). The attached Python code shows you how to do this.

0
4K
Member Avatar for vegaseat

This short Python snippet shows you how to read mouse wheel events with the Tkinter GUI toolkit. Windows and Linux have different bindings and read different events, but can be included in the same program code for use with either operating system.

0
21K
Member Avatar for vegaseat

This well commented Python snippet uses wxPython's plotting widget to graph the projectile motion of two different firing angles on the same plotting canvas.

1
265
Member Avatar for G-Do

Hi all, Have you ever heard of "Petals Around the Rose?" It's a logic puzzle. The way it works is, I roll five dice, then tell you what the "score" is for this round. I can repeat this for you as many times as you want. It's your job to …

0
855
Member Avatar for G-Do

[URL="http://www.bitstorm.org/gameoflife/"]Life[/URL] is a "game" or cellular automaton - an evolving computational state system - developed by a Cambridge mathematician named John Conway. The idea is simple: start with a board of dimensions (x,y). Populate the board with an initial pattern of occupied and empty cells. In every turn, the rules …

0
1K
Member Avatar for vegaseat

Sometimes you want to accomplish something with a minimum ammount of code. Here is an example of using modern Python concepts of lambda, list comprehension and all() to create an anonymous function that returns a prime list from 2 to n.

1
166
Member Avatar for allan14

A little program to convert angles to and from Decimal degrees, Degrees decimal minutes and Degrees minutes decimal seconds.

0
145
Member Avatar for allan14

Written using Boa Constructor, with code added to do the conversion from C to F or F to C. The code has been altered to give a single file so don't open it in Boa Constructor.

0
141
Member Avatar for vegaseat

A simple example of applying a font to a text displayed with wxPython's wx.StaticText widget.

0
595
Member Avatar for vegaseat

Just bouncing a red ball within the frame of a window, the twist here is that the image is stored within the code as a base64 encoded string of the gif image. This way you only have to distribute one file. The Python code is heavily commented, so you can …

Member Avatar for Arkapravo
2
364
Member Avatar for bumsfeld

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.

0
488
Member Avatar for vegaseat

Using count() from Python's itertools module and the Tkinter GUI toolkit's after() function, you can create a simple counter that counts up the seconds until the Stop button is pressed.

1
3K
Member Avatar for avgprogramerjoe

This code takes a string a cyphers it by shifting it's position in the alphabet. I've gotten it so it can pretty much take paragraphs. It's quite neat to play with. For example the above when shifted to 5, would be: Ymnx htij yfpjx f xywnsl f hDumjwx ny gD …

Member Avatar for ShawnCplus
0
141
Member Avatar for jasimp

This one works pretty fast, even for large numbers. Like it says, aproxomite end number, and that is because it will generally go one fibonacci number above what you specify.

Member Avatar for ilovepython1978
0
146
Member Avatar for vegaseat

The wxPython wx.lib.fancytext widget allows you to display super and subscripts in texts, and allows you to change fonts and colours too. All this is done with XML coded strings. XML documentation code is tag based and not that difficult to understand. It looks rather similar to the older HTML …

0
406
Member Avatar for jasimp

All this snippet does is asks you for some information and then uses it and some math to guess your age. Pretty simple but I have to start somewhere.

Member Avatar for majestic0110
0
156
Member Avatar for vegaseat

The wxPython GUI toolkit has a number of calendar widgets, but the one that is most customizable is the wx.lib.calendar widget. Here we expanded it to colour the weekends and the holidays supplied by a dictionary of 'month: list of holiday dates in month' pairs. Since some holiday dates can …

0
2K
Member Avatar for bumsfeld

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 …

0
2K
Member Avatar for aj.wh.ca

Problem Description ----------------------- I tried to download my favourite site containing essays on history (leeching) with depth 4. For some reason say my download tool problem, I realized I could not download all the files. I had with me a list of files (list1) I downloaded and list of files …

Member Avatar for vegaseat
0
110
Member Avatar for Ene Uran

This simple Python code uses the Tkinter GUI toolkit and the Python Image Library (PIL) to create a program that allows you to grab an image of the display screen (or portion of it) and save it to an image file. Unfortunately, the ImageGrab.grab() method only works on a Windows …

Member Avatar for AndyGman
1
3K
Member Avatar for vegaseat

Just a little mathematical exercise in geography, namely the use of longitude and latitiude coordinates to calculate the distance between two given cities. You can obtain the coordinates for just about any earthly city from [URL="http://www.ASTRO.COM"]WWW.ASTRO.COM[/URL]. The coordinates are in a format like 35n13 (35 degrees, 13 minutes north). The …

3
2K
Member Avatar for vegaseat

There are times when you have to layout widgets on a window area fairly well spaced apart. To do this with pack() or grid() will be more than frustrating, for these occasions place() with its absolute coordinates comes to the rescue. Here is some Python/Tkinter GUI code showing you how …

1
614
Member Avatar for vegaseat

The normal XOR crypting is used with a small base64 twist to produce printable crypted text.

2
341
Member Avatar for vegaseat

The surface or canvas established with wx.PaintDC() can be used to draw a number of shapes like lines, rectangles and circles. The snippet shows you how to select colors and then draw a few simple shapes. Use help(wx.PaintDC) to get information about the many things you can use this surface …

1
865
Member Avatar for mawe

The name says it all, I think. You have a nested list, you want to flatten it (e.g. because you want to count the occurence of an element), this function is all you need ;)

1
811
Member Avatar for Ene Uran

The small images you put on buttons and such are nice, but a real pain if you have to attach all those image files to your program. Python's base64 encoding module makes it easy to convert the binary image code to a string that you can simply make part of …

Member Avatar for vegaseat
0
2K
Member Avatar for Matt Tacular

Ever have two lists in python and you want to know what how much of one list the other contains? This code snippet will help you do that.

Member Avatar for vegaseat
0
350
Member Avatar for vegaseat

This little program uses Python and it's module pygame to do some sprite type animation. The rectangle that contains the image is moved and bounced within the window's frame. Pretty crude, since the whole screen frame is erased for each move. Actually it works smooth enough, and is relatively flicker …

Member Avatar for vegaseat
1
948
Member Avatar for vegaseat

Sometime in my childhood biology class I heard that the fancy colors of butterfly wings aren't really true colors, but interference patterns. This program claims to create interference patterns using a series of 3d sine waves using Python's popular pygame module. The whole contrivance is pretty to look at, and …

0
218

The End.