15,185 Topics
| |
Python's Tkinter module can be used to create a Graphics User Interface (GUI). This sample code creates a windows type form and positions a label and a canvas on the form. A simple shape is drawn on the canvas. | |
A common way to represent an inventory is with a list of tuples. Each tuple represents the item name and the item count. You can sort this inventory list by item name or item count. Here is an example to pick a sort key. It's your summer job to run … | |
The module datetime allows you to call several functions that can do computation with dates and times. How many days since my birth? How many days till Xmas? What's the date 77 days from now? The code snippet should give you a flavor, enough to explore on your own. | |
The wxPython library allows Python to create Windows GUI programs. Here is a look at the listbox component. Click a button to load the listbox with names, select the name by clicking on it on the list, and display it in the title bar of the window frame. Another button … | |
The set is an unordered collection of unique hashable elements. All the elements/items in a set are treated as keys. There are several functions that compare two sets. Right now, I will just give you a taste ... | |
Using wxPython and the Boa Constructor, a VB/Delphi like IDE and Visual Builder, this little calculator was a breeze to make. Boa did 90% of the code generation, and I simply added code to each button click event to make the calculations work. I wish every project would go that … | |
Another application of the Python Image Library (PIL). This time we are loading an image and rotate it counterclockwise by a specified number of degrees. The image is shown rotated and then saved to the working folder. PIL handles a fair amount of image file formats easily. | |
There are some pretty fancy things you can do with strings in Python. You can append, convert, justify, join, split, slice, and list selected files of a folder. I just give you a small sample here. | |
This is an application of the Python Image Library (PIL) and shows you how simple it is to do pixel math on an image. | |
| hi, i want to use a usb port, to power a led that i have hacked around with, it is connected to the usb cable, what i want to do is use it to make the led flash, how can i do it? |
I am new to python. I have a set of commands which I want to convert to a python script. commands are foreach f (`cat ../etc/l.list`) echo $f mkdir "$f" cd "$f" cp ../r/"$f".txt . cd .. end I succeded in creating folders with respective names as listed in l.list, … | |
Hello! I need some help regarding a file conversion. I have some .csv files and I need to convert them to .xls (to look exactly as a manually made table, not only to change the extension). The code should not be complex because the files have the same pattern so … | |
Is it possible to make a list with variables in it? I'm making a quick simple harmonic oscillator program from an old Fortran prog to learn Python and I'd like to use a list to control output to a text file. So far I have a list: [ICODE]writeLoop = [t, … | |
Hi all I'm needing help with a question in my tutorial due tomorrow... I'm given this file which contains the following: toy201, Racing Car, AB239:2,DC202:2,FR277:2,JK201:1,YU201:1,EE201:1,FW201:1 toy101, Barbie Doll, AB139:2,DC102:2,FR177:2,JK101:1,YU101:1,EE101:1,FW101:1 toy301, Flying Kite, AB339:2,DC302:2,FR377:2,JK301:1,YU301:1,EE301:1,FW301:1 I am now to define a function that gives the following from the above file: >>>load_prods(filename) {'toy301': … | |
hi based on this code: [code=python]def load_products(filename): def get_components(parts): """parts is a list of parts and their associated amounts, each separated into groups, split by (',')""" """need to take out each id, take out each integer, an associate them, by putting them in a pair -> return in big list""" … | |
I'm trying to parse xml, but am missing something. In the following, I can get the key, but not the value [code]from xml.dom import minidom xmlstring = '''<search ver="3.0"> <loc id="USAR0433" type="1">Paris, AR</loc> <loc id="USID0192" type="1">Paris, ID</loc> </search>''' dom = minidom.parseString(xmlstring) r = dom.getElementsByTagName('search')[0] res = [] for x in … | |
I use url retrive and reporthook to update wx.gauge. The problem i have is that after just a few updates it stops. I use a simple threading for the downloading process and guess thats the problem? [CODE] def trad(): thread.start_new_thread(download, ()) def download(): for url in open('url', 'r').readlines(): url = … | |
Hello all, This will hopefully be a quick and easy answer. I am having some difficulties with multiple lists that have certain characteristics, so what do I have: 4 lists, all the same length that signify: [row] [coumn] [VAR1] [VAR2] So basically I have 2 variables at each location (row,col) … | |
Hello I have a txt file with a pattern as below ============================================= Computer name: Abc IP address: 10.10.10.10 User name: user Last pin : Aug 06 2009 10:44:35 ============================================= Computer name: Def IP address: 10.10.10.11 User name: user2 Last pin : Aug 07 2009 10:44:35 ============================================= All I require is … | |
| I am trying to make a python tone generator, and don't know what modules to use. Any suggestions? |
I'm trying to learn the very basics of HTML parsing in python. Through these forums I learned what a parser is. [I] " Parsing often means "perform syntax analysis" on a program or a text. It means check if a text obeys given grammar rules and extract the corresponding information. … | |
[COLOR=#555555]I am a newbie to Python and need to transfer files across an internal network. Are there any coding tips or code snippets that would be helpful? Any assistance provided would be appreciated.[/COLOR] | |
Hi again, I just had a really quick question. Is there any kind of goto command in Python like there is in Java? | |
First Off. Total newbie here and first thread so go easy on me. I used the tut from the Starting wxPython (GUI code) thread. I have converted it to a text editor and added some annoying features to mess with my boss. I am able to open a file, edit … | |
Hi, Is there a way to split the string: 'Autocolli\^sion:No^Pack\^age:10DB15' on '^' character, but not if it follows a backslash? I have tried a regular expression like '[^\\]\^' but it removes also the 'o' in 'No'. Marcin | |
Hello, I need to generate graphs(nodes&links) on a web page in python. Please, could anyone suggest libraries/modules which could be used for it? I know about web graphics in Perl, but don't know about python. | |
For some reason (this hasn't happened to me in the past), any wxPython scripts I package via py2exe crash on my other Windows computer (lacking a Python install). If I try running it on my other machine, I get an error message telling me to look at a log file … | |
Hi, I have an application which writes some data to a file (csv). Now there is python script which is to be invoked once the application writes to the file. The application cannot generate any indication of completion of the process. I thought of opening that csv file and handling … | |
I am trying again(!) to learn enough Python to be able to process a bunch of files, and have run into something I don't understand right at the beginning. I am using Python 2.5 IDLE on a WindowsXP machine, and going through examples given in a Python tutorial. My understanding … | |
hi, is there anyway to display a .jpg (or other type) images in Tkinter with Python 3.1? From what I read here in the forum, for Python 2.6 I could use the PIL package. But the PIL packages doesnt support Pyton 3.1 yet (from what I read on the PIL … |
The End.