4,305 Posted Topics

Member Avatar for a1eio

Instead of lambda you can also use Python's partial function, new in Python25. Here is a simple example ... [code=python]# a tiny Tkinter calculator showing the # use of the new Python25 partial function import Tkinter as tk from functools import partial # needs Python25 or higher def click(key): global …

Member Avatar for a1eio
0
142
Member Avatar for biggz
Member Avatar for Ancient Dragon

Because of the rapid and deliberate devaluation of the US Dollar, you have to make sure your wealth is in another currency.

Member Avatar for vegaseat
0
248
Member Avatar for isinc

To retrieve key and val from the key:val pairs of a dictionary use this ... [code=python]stats_dic = { "ECSE":8, "LCSI":6, "ECOM":13, "ABIT":4, "ACSM":3, "AEXH":2, "AEXP":9, "BULS":6, "APME":8, "BBMB":3, "EBCL":2, "EEEL":9, "LDES":4, "LMAT":3, "LPHY":3, "LPSC":4, "LUHU":4, "LUPS":5, "LUSS":2 } for key, val in stats_dic.items(): # test it ... print key, val …

Member Avatar for isinc
0
414
Member Avatar for The Dude
Member Avatar for bumsfeld
Member Avatar for MidiMagic
Member Avatar for MidiMagic
Member Avatar for sneekula

People who talk about global warming on a hot day, but on a cold day they ignore the subject.

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

Another way to stay healthier, just in the news (3/7/2008): People who started drinking in middle age were 38 percent less likely to have a heart attack or other serious heart event than abstainers. [url]http://news.yahoo.com/s/nm/20080307/hl_nm/heart_drinking_dc_1[/url]

Member Avatar for vegaseat
0
143
Member Avatar for LanierWexford

First of all, please use the Python style guide by GVR himself: [url]http://www.python.org/peps/pep-0008.html[/url] To make code easier to read. I used a different Words.txt, but this should work ... [code=python]# WordPlay.py # saved the module in D:\Python25\Atest\Bull # use sys.path.append(r'D:\Python25\Atest\Bull') so PYTHONPATH can find it def avoid(word, forbid): """ Function …

Member Avatar for katharnakh
0
225
Member Avatar for efect

Check a program called Pyton4Delphi at: [url]http://www.mmm-experts.com/[/url] It allows you to use Python code within Delphi.

Member Avatar for vegaseat
0
149
Member Avatar for wokeup2sleep

kath is right, you have to keep track of it as a list, really a number of lists.

Member Avatar for wokeup2sleep
0
90
Member Avatar for PC_Nerd

Some of the basics of sending a text string to the printer are in the Python code snippet at: [url]http://www.daniweb.com/code/snippet399.html[/url] If you have a Python code file like this ... [code=python]# days2xmas.py # calculate days till xmas of 2008 import datetime as dt now = dt.date.today() # change the year …

Member Avatar for PC_Nerd
0
6K
Member Avatar for mikeandike22

[quote] Overview Java Language Conversion Assistant is a tool that automatically converts existing Java-language code into Visual C#® for developers who want to move existing applications to the .NET Framework. Java Language Conversion Assistant provides developers using Visual Studio .NET 2003 a quick, low-cost method of converting Java-language applications to …

Member Avatar for Nilkumar
0
196
Member Avatar for sneekula

A city car can be driven with compressed air for a distance of about 100 miles. Compressed air can be supplied by stations using electricty from nuclear power plants. The problem is that compressing air generates heat that needs to be used to heat homes, industry or green houses to …

Member Avatar for GrimJack
0
676
Member Avatar for asrekdal

If richedit is your wx.TextCtrl object set to style=wx.TE_MULTILINE|wx.TE_RICH2 then use richedit.SetInsertionPoint(0) richedit.SetStyle(start, end, wx.TextAttr("red", "yellow")) where start/end is the index range in your string you want to highlight in the given fg/bg colors.

Member Avatar for vegaseat
0
102
Member Avatar for nish88

Then you have to give your image object a name ... img1 = canvas.create_image(200, 250, image=photo) ... and delete that on specifically... canvas.delete(img1)

Member Avatar for vegaseat
0
10K
Member Avatar for StepIre

If you use the Tkinter GUI toolkit, you can use an input dialog box called askinteger, it makes sure only integers are entered. A typical example ... [code=python]# use Tkinter popup dialogs for input import Tkinter as tk import tkSimpleDialog as tsd # has askfloat, askinteger, askstring def get_data(): miles …

Member Avatar for vegaseat
0
100
Member Avatar for nish88
Member Avatar for vegaseat
0
1K
Member Avatar for Michael_Knight

[QUOTE=vmanes;542154]My favorite way to mess with folks is do a screen capture of their desktop, save it as an image, then display the image fullscreen (irfanview works well) They spend minutes clicking on their shortcuts, the start button, taskbar....[/QUOTE]Now that is really evil! Here I thought you were such a …

Member Avatar for MidiMagic
1
142
Member Avatar for sneekula

[QUOTE=jaepi;500009]I made love with Megan Fox. That was nasty![/QUOTE]I hope it was in Technicolor, Stereo and Smellavision (smile).

Member Avatar for GrimJack
0
504
Member Avatar for Dave Sinkula
Member Avatar for bumsfeld
0
205
Member Avatar for TheNNS

McDonalds used to serve an egg nog flavored milk shake this time of the year, I need to check if they still do. Maybe AD can give us a hint what else tastes good there.

Member Avatar for Lardmeister
0
918
Member Avatar for MattEvans

I think Indonesia is lucky enough to have the most earthquakes, tsunamis and exploding volcanoes.

Member Avatar for sneekula
0
228
Member Avatar for The Dude

My nick goes back to my younger days when I designed a more luxurious seat (with heating, cooling and stereo) for the Chevy Vega. It was rejected because it cost 10 cent more than the standard seat from Fisher.

Member Avatar for maui_mallard
0
245
Member Avatar for Lardmeister

How does this challenge your intelligence? Knowing Lardmeister and his ilk, this is a euphemism for mildly unintelligent.

Member Avatar for vegaseat
0
116
Member Avatar for zandiago

vegas-eat: I go to Las Vegas a lot to eat, drink and gamble. Gambling costs money, drinks and food are mostly free!

Member Avatar for jbennet
0
364
Member Avatar for Carlo Gambino

You can use the enumerate function and incrementally increment the ascii value of the character ... [code=python]s = 'aaaa' q = "" for ix, e in enumerate(s): q += chr(ord(e) + ix) print q # abcd [/code]For your first problem you could use something similar ... [code=python]a = [1, 2, …

Member Avatar for jrcagle
0
143
Member Avatar for implor

[code=python]s = "u'mystring'" # assuming it is always u' s2 = s.replace("u'", "'") print s2 # 'mystring' [/code]

Member Avatar for jrcagle
0
17K
Member Avatar for vmanes

[QUOTE=Lardmeister;541712]Swiss banks are notorious for laundrying dirty criminal money. I wish more of their employees would come foreward and spill the beans.[/QUOTE]Hmm, I thought only the Lichtenstein bankers did that sort of stuff. I will have to check it out.

Member Avatar for Lardmeister
0
293
Member Avatar for zandiago

My basic assumption is that there is no such thing as privacy when it comes to government action. This has been broadened by the fear of terrorism. You want some privacy, encrypt your files.

Member Avatar for jbennet
0
640
Member Avatar for Carlo Gambino

Fun with ascii values of a string ... [code=python]def ascii_list(s): """return a list of ascii values of the characters in string s""" return [ord(c) for c in s] s = 'cat' alist = ascii_list(s) print alist # [99, 97, 116] # manipulate the list elements alist[0] += 1 alist[1] += …

Member Avatar for Carlo Gambino
0
152
Member Avatar for roelandt

Please use the [b][noparse][code=python][/noparse][/b] and [b][noparse][/code][/noparse][/b] tag pair to enclose your python code. Without this the code becomes very difficult to read, since all indentations are lost.

Member Avatar for woooee
0
102
Member Avatar for pythoxine

I am not sure if it's the best one, but pyenchant is very good: [url]http://pyenchant.sourceforge.net/[/url]

Member Avatar for vegaseat
0
79
Member Avatar for zclevenger

Here is a hint ... [code=python]""" Part of typical csv file (Country.csv): NAME,ISO,CAPITAL,POPULATION,AREA Afghanistan ,AF ,Kabul,28513677,647500 Albania ,AL ,Episkopi,3544808,28748 Algeria ,AG ,Tirana,32129324,2381740 American Samoa ,AQ ,Algiers,57902,199 Andorra ,AN ,Pago Pago,69865,468 Angola ,AO ,Andorra la Vella,10978552,1246700 """ for line in file("Country.csv"): # skip header if 'NAME' in line: continue # remove …

Member Avatar for jrcagle
0
173
Member Avatar for Lardmeister

I would put lawyers under politicians, since most of them are lawyers. I haven't bought a used car for a long time and always assumed that kicking a tire or two would be better than listening to the used car salesman.

Member Avatar for Lardmeister
0
729
Member Avatar for +--RagS--+

Here is one way to do this ... [code=python]from Tkinter import * from tkFileDialog import askdirectory def browser(): dir1 = askdirectory(title="Select A Folder", mustexist=1) if len(dir1): #print dir1 e1.insert(0, dir1) root = Tk() e1 = Entry(root) e1.pack() b1 = Button(root, text='Browse', command=browser) b1.pack() root.mainloop() [/code]

Member Avatar for +--RagS--+
0
108
Member Avatar for The Dude

As many times as I say "Oh God!" there better be one. God seems to be individually modified to suit the person.

Member Avatar for twomers
4
518
Member Avatar for The Dude
Member Avatar for The Dude
Member Avatar for The Dude
Member Avatar for Lardmeister
0
121
Member Avatar for The Dude
Member Avatar for The Dude
Member Avatar for turnerca902

Create the initial test file ... [code=python]data = """Astronomical Applications Dept. U.S. Naval Observatory Washington, DC 20392-5420 ST. PETER'S NOVA SCOTIA o , o , W 60 52, N45 39 Altitude and Azimuth of the Sun Jun 7, 2008 Zone: 3h West of Greenwich Altitude Azimuth (E of N) h …

Member Avatar for turnerca902
0
733
Member Avatar for KomodoM

You might be able to use this ... [code=python]# this gives daily info: # takes care of leap-years too import datetime as dt wday = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] start = dt.date(1900, 1, 1) oneday = dt.timedelta(days=1) # test it for the first 370 days for x …

Member Avatar for KomodoM
0
117
Member Avatar for wolih

I think there needs to be a self.window.show() in __init__ similar to the example below. [code=python]# very basic GTK/Python program showing just a window # you have to install GTK runtime, PyCairo, PyGobject and PyGTK for this to work import gtk class Base(object): def __init__(self): self.window = gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.show() def …

Member Avatar for wolih
0
134
Member Avatar for Jicky

"SuPeRcAlIfRaGiLiStIcExPiAlIdOcIoUs" works well for me as a password.

Member Avatar for technogeek_42
0
387
Member Avatar for charles_wt

I checked my old Borland C++ compiler, you may have to add the .h to your includes! #include<iostream.h> #include<cstdlib.h>

Member Avatar for WaltP
0
314
Member Avatar for Ene Uran

I will watch it for the beer and pizza party, the halftime show, and the Budwiser commercials. I also hope to see some more or less spectacular plays! Maybe somebody runs over a ref for the fun of it. It's true, Budwiser does make your bud wiser.

Member Avatar for maravich12
0
309

The End.