988 Posted Topics

Member Avatar for tweak

You can also check into the use of the PyQT GUI toolkit. It is available free and even works with Python 3.1. There is an example here that should work with your application: [url]http://www.daniweb.com/forums/post979747.html#post979747[/url] It has a few extras, like clicking on the table column header to sort by that …

Member Avatar for tweak
0
169
Member Avatar for KernMilestone

A dying man gathered three of his best friends, a Lawyer, a Doctor and a Clergyman at his bed side and handed each of them an brown envelope containing $50,000 in cash. He asked them to put these envelopes into his coffin before it gets closed and buried, so he …

Member Avatar for quicktpgo
0
553
Member Avatar for Lingson

There is a working example of Tkinter's radio buttons and also a comparative look at check buttons at: [url]http://www.daniweb.com/forums/showpost.php?p=966368&postcount=58[/url]

Member Avatar for sneekula
0
4K
Member Avatar for jocose

I don't think it's possible because py2exe does not include any source, only the byte code compiled files in case you go for the zip file option.

Member Avatar for sravan953
0
152
Member Avatar for AutoPython

Take a looky here: [code=python]import string print(string.digits) print(string.ascii_lowercase) print(string.ascii_uppercase) # optional ... #help(string) [/code] Also, all your many deletes are not needed, since variables are handled very well by Python's excellent built-in memory manager. On top of that, the variables in functions are local and are deleted after the function …

Member Avatar for AutoPython
0
248
Member Avatar for frank.zappa

It's not quite as simple! However you use Portable Python. It installs a portable version of Python right on an inexpensive USB flash drive (plan on 150MB for each version). You can use the flash drive now on Windows computers that do not have Python installed. It comes in Python25, …

Member Avatar for sravan953
0
814
Member Avatar for AutoPython

Give us your code and we will help you understand. For instance: [code=python]def myloop(): for x in range(5): y = 2*x return y # this will give 8, since the last x in the loop was 4 print(myloop()) [/code]

Member Avatar for AutoPython
0
104
Member Avatar for computerfreak97

Take a look at Python's audioop module in the manual. Python has some additional modules like 'sunau', ' aifc' and 'wave' that offer sound file reading, writing and some 'rythmatic'.

Member Avatar for computerfreak97
0
51
Member Avatar for mahela007

Look over this code sample, it should be very explanatory: [code=python]# role of self in Python classes # self can be named different, but 'self' is convention class Snake: def __init__(self, name): # self keeps track of each instance # and also makes self.name global to class methods self.name = …

Member Avatar for mahela007
0
130
Member Avatar for zandiago
Member Avatar for t3ch|\/|4n
0
185
Member Avatar for rhoit
Member Avatar for mukulbudania
0
194
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

Nice to know that C# has gained popularity apart from the original MS Visual IDE. It can be used on Linux platforms using Mono instead of .NET. There is also an official language standard at: [url]http://www.ecma-international.org/publications/standards/Ecma-334.htm[/url] I think the GUI capabilities are great.

Member Avatar for Ene Uran
0
1K
Member Avatar for eXceed69
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 Ene Uran

Nothing fancy. just shows a simple monthly calendar in a Tkinter label. The trick is to use a fixed font so spaces take up the same area as numbers.

Member Avatar for ndhdo
0
288
Member Avatar for Ene Uran

Let's say you had a list of full names, where the name would consist of a title, followed by first, middle and last name, or maybe just title and last name. You can sort this list by last name only, by creating a temporary list of sublists of type [last …

0
486
Member Avatar for Ene Uran

The snippet shows the use of a list of class instances to form a sortable and searchable database for solvents, or for that matter other chemicals. The list can be expanded and all the needed data added at the same time.

0
269
Member Avatar for Ene Uran

Just a short little C program to send beeps to the PC internal speaker. Beep(frequency_hrz, duration_ms) is a WinAPI function as is Sleep(ms).

Member Avatar for Ene Uran
1
327
Member Avatar for Ene Uran

A list of tuples is easy to sort for items in the tuples. This snippet shows you how to sort a (character, frequency) tuple either by character or by frequency. One useful example would be the sorting and display of a list of (player, score) tuples, you might find in …

0
252
Member Avatar for bumsfeld

I get these results on a Windows Xp machine: [code]Function while1() takes 9.358 microseconds/pass Function for1() takes 10.075 microseconds/pass Function for2() takes 10.604 microseconds/pass [/code] Wonder why xrange() is even slower?

Member Avatar for Begjinner
0
2K
Member Avatar for Ene Uran

Powers of 2 are closly linked to the position values of binary numbers. The most right position is 2 to the power 0 = 1 then goes to the left with 2 to the power 1 = 2, 2 to the power 2 = 4 and such. If you want …

1
149
Member Avatar for Narue
Member Avatar for VSBrown

"Modify the program in Fig 2.21 so it uses only integers for monetary values to calculate the compound interest." Why would you ever want to do that for?

Member Avatar for Ene Uran
0
186
Member Avatar for catcit

Take a look at: [url]http://sourceforge.net/projects/pyexcelerator/[/url] Here is example code: [url]http://sujitpal.blogspot.com/2007/02/python-script-to-convert-csv-files-to.html[/url]

Member Avatar for catcit
0
145
Member Avatar for Ally89

A nice brain teaser to get to know Python, here are some hints: [code=python]"""wants dictionary object --> {'toy301': ('Flying Kite', [('AB339',2),('DC302',2),('FR377',2), ('JK301),1),('YU301',1),('EE301',1),('FW301),1)])} """ # typical data line from a file line = """\ toy301, Flying Kite, AB339:2,DC302:2,FR377:2,JK301:1,YU301:1,EE301:1,FW301:1 """ # first split the line at the commas list1 = line.split(",") print(list1) …

Member Avatar for Ally89
0
133
Member Avatar for mediachicken

[QUOTE=mediachicken;957093]OOOOOH, putpixel places an image? Or does it draw a dot? I guess it's time to experiment...[/QUOTE]An image is made up of dots.

Member Avatar for Ene Uran
0
2K
Member Avatar for iamthwee

[QUOTE=iamthwee;685987]OK if I want to distribute this code will I have any legislation issues?[/QUOTE]Send an envelope with 100 unmarked $100 bills to the political party in power and you wont have any legislation issues. Thanks for the nice info anyway!

Member Avatar for miesnerd
0
1K
Member Avatar for Ancient Dragon

The burn unit at the hospital I work has received large donations from Michael. He was a great man in every way!

Member Avatar for GrimJack
0
298
Member Avatar for sab73
Member Avatar for vegaseat

[QUOTE=Hiroshe;914049]Yeah, I kinda don't like the idea of google making an os... I can see google becoming an open source version of microsoft, trying to dominate every single market it see's. I don't think windows seven will run vary well on my poor little aspire one, so I have to …

Member Avatar for kaninelupus
0
637
Member Avatar for The Dude

There is a much higher chance that your luggage ends up at another airport!

Member Avatar for The Dude
0
130
Member Avatar for The Dude
Member Avatar for Davide Davin

I think these two lines: c= content(self,-1) Main.View.Template.Age.__init__(self, parent,id,c) present a catch22 situation self comes from line2 and c comes from 1

Member Avatar for Davide Davin
0
183
Member Avatar for Ene Uran

Just in the news: North Korea's military is behind a series of cyber attacks against South Korean and U.S. websites that slowed or disabled access by saturating them with traffic this week, a South Korean news report said on Saturday.

Member Avatar for MosaicFuneral
0
174
Member Avatar for denniskhor

If you are specifically looking for the text line: 'you love me' then sravan953 code works best. leegeorg07 code using 'in' would also give you a positive with a line like: 'you love me not' which may be misleading.

Member Avatar for zachabesh
0
451
Member Avatar for Heftiger

Python31 includes Tkinter Tile extension ttk. That extension has a Treeview widget that can function as a multicolumn Listbox. Here ia an example, that you may have to simplify somewhat: [code=python]"""Demo based on the demo mclist.tcl included with tk source distribution.""" import tkinter as tk import tkinter.ttk as ttk import …

Member Avatar for Ene Uran
0
2K
Member Avatar for teonghan

Just a note: The easiest way to break out of the innermost loop of nested loops is to put them into a function and use return instead of break.

Member Avatar for scru
0
2K
Member Avatar for Menster
Member Avatar for rishabhv
0
297
Member Avatar for clbembry

Oh dear, my advice to any beginner, start with small programs and experiment with them to get a feeling of what those widgets do. A mini frame can not be used as a toolbar! It is just like a frame with limitations.

Member Avatar for lllllIllIlllI
0
265
Member Avatar for UrbanKhoja

The debt per person in the USA is cheap compared to other countries. Let's celebrate with Chinese fireworks! I love the stench of burning sulfur from the fireworks, much better than the normal LA stench.

Member Avatar for Ene Uran
2
478
Member Avatar for wotthe2000

Just for the sake of being pythonic: [code=python]book = ['1234', '1235', '1236', '1237', '1238'] # you only need to open the file once f = open('/home/tandberg/booklist', 'w') for a in book: f.write(a + '\n') f.close() [/code]

Member Avatar for Ene Uran
0
72
Member Avatar for lblazer05

shadwickman is right, data = [x.strip() for x in line.split('=')] works because x inside the list comprehension is still a string and not a list yet. You might want to convert the numeric strings to actual numbers you can do calculations with using int() or float(). Here is my dime's …

Member Avatar for Ene Uran
0
141
Member Avatar for sneekula

[QUOTE=thoughtcoder;874359]Who gets viruses? You have to try hard to get viruses on Windows. Stop pirating software, then you won't get viruses.[/QUOTE]You try to tell the rest of us that it is a copy protection scheme? Be real. The internet is a good source of the ugly beasts. Now the question …

Member Avatar for vegaseat
0
230
Member Avatar for gianniszaf

One way to do this is to pad each word with spaces at the end to make the words equal in length (max length + 2): [code=python]s = """\ dasj dhsahdwe dhasdhajks ewqhehwq dsajkdhas edward das dsaw das daswf fjdk ewf jken dsajkw dskdw hklt ewq vn1 daskcn daskw """ …

Member Avatar for vegaseat
0
553
Member Avatar for Jonx

Might as well go with: [code=python] ... background = "C:\\python26\\stuff\\bg.jpg" background_surface = pygame.image.load(background) ... [/code]Since that kind of directory name is meant for Windows only.

Member Avatar for vegaseat
0
2K
Member Avatar for kes_ee

Simply use list(): [code=python]list1 = ['a', 'b', 'c', 'd'] # this will create a new list with a different mem ref temp_list1 = list(list1) for i in range(len(list1)): temp_list1[i] = "1" print list1; # ['a', 'b', 'c', 'd'] print temp_list1; # ['1', '1', '1', '1'] [/code]For nested lists you need …

Member Avatar for vegaseat
0
130
Member Avatar for rockyman12

[QUOTE=rockyman12;910763]Can anyone give me a qick review about Python Why its good ? Why its not ? What is the most suitable type of project for it ?? (application) And so one Thanks for your help[/QUOTE]You strike me as the kind of inquisitive person that is made for learning C++, …

Member Avatar for Ene Uran
0
125
Member Avatar for joe82

You mean something like this: [code=python]# data string read from a file data = """\ gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 95 20 1 0 68 87 31017559 31017578 4.4 32.3 gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 91.67 24 2 0 63 86 35247737 35247714 4.4 32.3 gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 91.67 24 2 0 64 87 40549054 40549031 4.4 …

Member Avatar for joe82
0
4K
Member Avatar for Salem

Let's see if the Omron Smile Scan system works on holders of State of California short term debts and bonds. California has started pay off with I.O.U.'s rather than actual money.

Member Avatar for MosaicFuneral
0
176

The End.