46 Topics

Member Avatar for Ene Uran

Most commonly a dictionary of key:value pairs is searched by the unique key. Sometimes it becomes necessary to search for the key, or keys given a value. Special consideration has to be given to this case, because the value does not have to be unique and may return several keys …

Member Avatar for Lucaci Andrew
0
4K
Member Avatar for Ene Uran

More or less a templet database that allows you to load, save, add, list, search, edit and delete data items. I used movies as an example, but you can easily change that to make a database of many other things.

Member Avatar for james.lu.75491856
1
998
Member Avatar for Ene Uran

Does anybody have experience with Python on the iPad? Is it easy to get and use Python?

Member Avatar for chriswelborn
1
148
Member Avatar for Ene Uran

Just a simple console blackjack game. The bread and butter code was written with lots of comments, so you can improve on it. Really, the most important part is figuring out when an ace is 11 in value and when it is a 1 in value, so you don't bust.

Member Avatar for s4bb4t
1
8K
Member Avatar for Ene Uran

You can download the matplotlib free from: [url]http://matplotlib.sourceforge.net/[/url] It has, amongst many other things, the module pylab that allows for high quality plotting of data. All you have to do is to feed it a list of x values and the corresponding list of y values calculated from the x …

Member Avatar for Flintstone_
2
2K
Member Avatar for Ene Uran

This is my first experience with Python's Tkinter GUI. I want to write a program where the result of an interim calculation is displayed on a label. Later in the program I want to use this result in another calculation by simply clicking on the label. This is what I …

Member Avatar for vegaseat
0
3K
Member Avatar for Ene Uran

I kind of like this little poem: [QUOTE][COLOR="DarkGreen"]The Spell Checker Poem ... Eye halve a spelling chequer It came with my pea sea It plainly marques four my revue Miss steaks eye kin knot sea. Eye strike a key and type a word And weight four it two say Weather …

Member Avatar for chickenfarmer
0
359
Member Avatar for Ene Uran
Member Avatar for Ene Uran

I have two similar lists and want to create a new list with just the differences between the two. Is there an existing function or do I have to iterate with a for loop?

Member Avatar for Gribouillis
0
2K
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 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 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 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 Ene Uran

I am looking for a good example of the tarfile module, writing to and reading from an archive. Particularly the highly compressed filename.tar.bz2 format.

Member Avatar for BearofNH
0
154
Member Avatar for Ene Uran

For the second year running Python has been selected as the Language of the Year by Linux users: [code] Linux Users' Programming Languages of the Year 2008 PHP 115 13.36% Perl 72 8.36% Python 226 26.25% Ruby 46 5.34% C 114 13.24% C++ 129 14.98% Java 106 12.31% Lisp 9 …

Member Avatar for breatheasier
0
146
Member Avatar for Ene Uran

Since so many folks are going around and wishing you a 'Happy New Year', I wonder what would make you happy. Getting an interesting higher paying job would make me happy.

Member Avatar for vegaseat
0
160
Member Avatar for Ene Uran

Only for experts: [url]http://www.funnyjunk.com/movies/1498/Kissing+Prank/[/url]

Member Avatar for sneekula
1
73
Member Avatar for Ene Uran

Just got a PM on DaniWeb with this sender: From Miss Patricia Dick Abidjan,Cote D'Ivoire The rest is a typical Nigerian financial scam! Did anybody else get this? The user name was blessing12

Member Avatar for Lardmeister
0
161
Member Avatar for Ene Uran

Just noticed that I passed the ever so sweet 1000 postings mark! Isn't DaniWeb great!

Member Avatar for mackone
2
108
Member Avatar for Ene Uran

What Windows Vista program runs the Compiled HTML Help Files (.chm)? Under properties only a meaningless descriptor shows up.

Member Avatar for Ene Uran
0
247
Member Avatar for Ene Uran

I find those new popup ads from HSBC on DaniWeb very annoying and would in no way become a customer of HSBC. What are these folks thinking?

Member Avatar for Dani
0
160
Member Avatar for Ene Uran

I was told this forum was global, but I will ask the question anyway. This Sunday is Superbowl Sunday, when at least in the USA and countries that have US Military bases millions of sports watchers will be glued to the TV to watch the final glorious football game of …

Member Avatar for maravich12
0
309
Member Avatar for Ene Uran

A small thread to honor those with creative or simply nice avatars. I like Sulley's Boo avatar

Member Avatar for sneekula
1
262
Member Avatar for Ene Uran

Illustrates the close relationship of the hard-software industry to April first: [CODE=c]#include <nonsense.h> #include <lies.h> #include <spyware.h> /* Microsoft Network Connectivity library */ #include <process.h> /* For the court of law */ #define say(x) lie(x) #define computeruser ALL_WANT_TO_BUY_OUR_BUGWARE #define soon next_year #define the_product_is_ready_to_ship another_beta_version void main() { if (latest_window_version>one_month_old) { …

Member Avatar for thekashyap
0
158
Member Avatar for Ene Uran

I don't know how it is in your country, but in the good old USA election time is coming up. I will go to the voting place and look at the slate of sh*t, and whomever I vote for will be, you guess what. Any idea how to change things …

Member Avatar for happygeek
0
93
Member Avatar for Ene Uran

What is a closure? I keep reading this word in programming, but never got a good explanation.

Member Avatar for Ene Uran
0
286
Member Avatar for Ene Uran
Member Avatar for Ene Uran
0
817
Member Avatar for Ene Uran

Is there a way to verify an exit, if you click on the exit symbol on a wxPython frame?

Member Avatar for Ene Uran
0
79
Member Avatar for Ene Uran

Does Python have a module to display when a file has been last modified? Also, how do you get the file length?

Member Avatar for bumsfeld
0
670
Member Avatar for Ene Uran
Member Avatar for vegaseat
0
189
Member Avatar for Ene Uran

I read somewhere that you should avoid using a leading underline in a variable name. It is supposed to have a special meaning in Python. I can't find anything more detailed. Does anybody know?

Member Avatar for vegaseat
0
309
Member Avatar for Ene Uran

Does Python have a static variable like C has? I like to avoid a global variable for the usual reasons. Note: A static variable in a C function will retain its last value.

Member Avatar for vegaseat
0
149
Member Avatar for Ene Uran
Member Avatar for bumsfeld
0
5K
Member Avatar for Ene Uran

What is the best way to establish a wxPython event handler for a mouse click, button and so on? I have looked at a number of sample codes and the event handlers differ all over the place.

Member Avatar for Ene Uran
0
380
Member Avatar for Ene Uran

I am fairly familiar with C, but new to Python. Does Python have something like the handy C conditional expression? For example: [code]// C conditional expression x = a ? b : c; // if a is true then x = b else x = c // here used to …

Member Avatar for Ene Uran
0
118
Member Avatar for Ene Uran

What is the order of the code snippets, they used to be in alphabetical order by title. Now I can't even figure it out, and it is very hard to find anything.

Member Avatar for Dani
0
177
Member Avatar for Ene Uran

Python uses the directories listed in PYTHONPATH to find a module. How can I assure that the module I am importing is on this list of paths?

Member Avatar for vegaseat
0
176
Member Avatar for Ene Uran

I keep hearing that the eval() function is unsafe. It is a nice function, because you can use it like print eval("2.5*49.7/(23+3.14)") and it will solve the math. Is there any way to protect against some nasty minded person to enter a "os.system(command)" where the command will erase a file …

Member Avatar for Ene Uran
0
104
Member Avatar for Ene Uran

I have the following code, for example: [CODE]price = 50.00 tax = price * 0.08 print "Tax = $",tax # Tax = $ 4.0[/CODE] As you can see there is a space between $ and 4.0. Is there a way to avoid this? I haven't done much Python coding.

Member Avatar for vegaseat
0
111
Member Avatar for Ene Uran

Couldn't sleep last night, so I was browsing and found the "Starting Python" thingy. I must say Python looks interesting from the examples. I learned C++ in school, Python sure looks easier to understand. Does any one think it's better than C++?

Member Avatar for vegaseat
0
178
Member Avatar for Ene Uran

Does anybody know if there is a good C++ code library that can process MIDI music files?

Member Avatar for Stoned_coder
0
85

The End.