988 Posted Topics
Re: 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 … | |
Re: 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 … | |
Re: 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] | |
Re: 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. ![]() | |
Re: 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 … | |
Re: 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, … ![]() | |
Re: 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] | |
![]() | Re: 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'. ![]() |
Re: 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 = … | |
Re: Similar to: [url]http://www.daniweb.com/code/snippet569.html[/url] | |
Re: Similar to: [url]http://www.daniweb.com/code/snippet176.html[/url] | |
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 … | |
Re: 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. | |
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 … | |
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. | |
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 … | |
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. | |
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). | |
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 … | |
Re: 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? | |
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 … | |
Re: "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? | |
Re: 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] | |
Re: 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) … | |
Re: [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. | |
![]() | Re: [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! |
Re: The burn unit at the hospital I work has received large donations from Michael. He was a great man in every way! | |
Re: Where are your FileIn and FileOut strings? | |
Re: [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 … | |
Re: There is a much higher chance that your luggage ends up at another airport! | |
Re: 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 | |
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. | |
Re: 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. | |
Re: 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 … | |
Re: 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. | |
Re: And you think MS isn't spying on your OS activities? Get real! | |
Re: 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. | |
Re: 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. | |
Re: 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] | |
Re: 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 … | |
Re: [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 … | |
![]() | Re: 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 """ … |
Re: 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. | |
Re: 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 … | |
Re: [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++, … | |
Re: 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 … | |
Re: 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. |
The End.