Ene Uran 638 Posting Virtuoso

At least the war on the environment is going well.

Ezzaral commented: ;) +10
Ene Uran 638 Posting Virtuoso

In Spain the working people are obligated by the state to contributed to the Roman Catholic Church whether they want or not. This is accomplished via income tax, but is not deductible. In fact, many even don't know that some of their money goes to the archives of the Catholic Church.

That cuts out all the cheating!

Ene Uran 638 Posting Virtuoso

Women who seek to be equal with men lack ambition.

Ene Uran 638 Posting Virtuoso

Is it rue that vegetarians are simply lousy hunters?

Ene Uran 638 Posting Virtuoso

Stop repeat offenders. Don't re-elect them!

Ene Uran 638 Posting Virtuoso

McCain: "Obama will raise your taxes, I won't."

The only problem is that he will be too old to remember!

Ene Uran 638 Posting Virtuoso

Taxation with representation isn't so hot either!

Ene Uran 638 Posting Virtuoso

Lawyers have feelings too!

Ene Uran 638 Posting Virtuoso

Honk If you want to see my finger.

Ene Uran 638 Posting Virtuoso

Is a 'himbo' the male counterpart of a 'bimbo?'

Ene Uran 638 Posting Virtuoso

A bag of Yablonovyy dark chocolate covered cashews.

Ene Uran 638 Posting Virtuoso

I think the new Pope is quite hip! Let's support the poor fellow with your tax deductible donation!

Ene Uran 638 Posting Virtuoso

It is well enough that people of the nation do not understand our banking and monetary system, for if they did, I believe there would be a revolution before tomorrow morning.
-- Henry Ford

Ene Uran 638 Posting Virtuoso

I will wait till Win7.1 comes out.

Ene Uran 638 Posting Virtuoso

I dream things that never were.

Ene Uran 638 Posting Virtuoso

I indeed do get the same error. I am using version 2.2.3. Is there any way for me to get around this?

It might be time to upgrade to the current version 2.5.2. Your version is very, very old!

In the mean time try to use solsteel's approach.

Ene Uran 638 Posting Virtuoso

Slight variation of ChrisP_Buffalo's suggestion:

# create number:frequency dictionary

num_freq = {}
for num in file("floats.txt"):
    #print num, type(num)
    # strip trailing new lines
    num = num.rstrip()
    num_freq[num] = num_freq.get(num, 0) + 1

#print num_freq

print '-'*30

# create sorted list of (freq, number) tuples
# high freq first, show freq then number
vals = sorted([(v, k) for k, v in num_freq.items()], reverse=True)
for val in vals:
    print val[0], val[1]

"""
this data file:
8.82728929832475D-004
0.373223841916055
0.269732448122138
4.06291083143060D-002
0.102697923377643
5.90299902998276D-002
2.20778238968052D-002
1.50498329458987D-002
0.269732448122138
2.15552885207953D-002
3.32530592527098D-002
0.275937019332351
0.102697923377643

would show:
2 0.269732448122138
2 0.102697923377643
1 8.82728929832475D-004
1 5.90299902998276D-002
1 4.06291083143060D-002
1 3.32530592527098D-002
1 2.20778238968052D-002
1 2.15552885207953D-002
1 1.50498329458987D-002
1 0.373223841916055
1 0.275937019332351

"""
Ene Uran 638 Posting Virtuoso

The information a statusbar can display can come handy:

# set up a customized statusbar with three display fields
# a statusbar is typically an information line at the bottom of a window

import wx
import time

class MyFrame(wx.Frame):
    def __init__(self, parent, mytitle, mysize):
        wx.Frame.__init__(self, parent, wx.ID_ANY, mytitle, size=mysize)
        # fill the top part with a panel
        panel = wx.Panel(self, wx.ID_ANY, style=wx.SUNKEN_BORDER)
        panel.SetBackgroundColour("blue")

        self.sb = wx.StatusBar(self, wx.ID_ANY)
        # set the status bar with three fields
        self.sb.SetFieldsCount(3)
        # set an absolute status field width in pixels
        # (negative indicates a variable width field)
        self.sb.SetStatusWidths([-1, -1, -1])
        self.SetStatusBar(self.sb)
        # put some text into field 0 (most left field)
        self.sb.SetStatusText("some text in field 0", 0)
        self.sb.SetStatusText("some text in field 1", 1)

        # use a timer to drive a date/time string in field 3
        # here the most right field of the statusbar
        self.timer = wx.PyTimer(self.onUpdate)
        # update every 1000 milliseconds
        self.timer.Start(1000)
        self.onUpdate()

    def onUpdate(self):
        t = time.localtime(time.time())
        st = time.strftime("%d-%b-%Y   %I:%M:%S", t)
        # put date/time display string into field 2
        self.sb.SetStatusText(st, 2)


app = wx.App(0)
# create a MyFrame instance and show the frame
MyFrame(None, 'test the wx.StatusBar', (460, 300)).Show()
app.MainLoop()
Ene Uran 638 Posting Virtuoso

Amazing what those companies used to sell sugar to the kids.

Ene Uran 638 Posting Virtuoso

Nice find!

Does anyone still listen to the radio?

Ene Uran 638 Posting Virtuoso

A very good and thorough memo!

Ene Uran 638 Posting Virtuoso

Will Homeland Security put Barack Obama on the passenger terrorist list because he visited Afghanistan?

Ene Uran 638 Posting Virtuoso

Three young boys were fighting over whose dad was the best.

"My dad is real good, he can shoot an arrow, run after it, get in front of it, and catch it in his bare hands."

"My dad is real good, he can shoot a gun, run after the bullet, get in front of it and catch it in his bare hands."

"I've got you both beat. My dad's real good because he works for the city. He gets off work at 17:00 and is already home by 13:30!"

Ene Uran 638 Posting Virtuoso

Since both present presidential candidates are questioning trade policies, here is a word of wisdom from the present President:
"It's very important for folks to understand that when there's more trade, there's more commerce."

Quebec City, Canada
04/21/2001
at the Summit of the Americas

Ene Uran 638 Posting Virtuoso

actually i ve pasted the exact copy of d statement from the IDLE shell.. so i don think these 2 syntax errors do exist..

Strange, works just fine for me in either the IDLE editor or the shell.

Ene Uran 638 Posting Virtuoso

wat is typo?

Slang for typing error!

Ene Uran 638 Posting Virtuoso

Okay, here is a simple create a window, input through an Entry, action with a Button and output to a Label code example:

# a simple Tkinter number guessing game
# shows how to create a window, an entry, a label, a button,
# a button mouse click response, and how to use a grid for layout

from Tkinter import *
import random

def click():
    """the mouse click command response"""
    global rn
    # get the number from the entry area
    num = int(enter1.get())
    # check it out
    if num > rn:
        label2['text'] = str(num) + " guessed too high!"
    elif num < rn:
        label2['text'] = str(num) + " guessed too low!"
    else:
        s1 = str(num) + " guessed correctly!"
        s2 = "\n Let's start a new game!"
        label2['text'] = s1 + s2
        # pick a new random number
        rn = random.randrange(1, 11)
    enter1.delete(0, 2)


# create the window and give it a title
root = Tk()
root.title("Heidi's Guess A Number Game")

# pick a random integer from 1 to 10
rn = random.randrange(1, 11)

# let the user know what is going on
label1 = Label(root, text="Guess a number between 1 and 10 -->")
# layout this label in the specified row and column of the grid
# also pad with spaces along the x and y direction
label1.grid(row=1, column=1, padx=10, pady=10)

# this your input area
enter1 = Entry(root, width=5, bg='yellow')
enter1.grid(row=1, column=2, padx=10)
# put the cursor into the entry field
enter1.focus()

# this is your mouse …
Ene Uran 638 Posting Virtuoso

This is one way to produce a syntax error:
pint " Hello Cu Python!"
or ...
Print " Hello Cu Python!"

Remember Python is case sensitive.

Ene Uran 638 Posting Virtuoso

If you had a lever long enough, could you really move the world?

Ene Uran 638 Posting Virtuoso

My boyfriend's favorite quote:
"I should warn you that underneath these clothes I'm wearing boxer shorts and I know how to use them."

Cracks me up!

Ene Uran 638 Posting Virtuoso

Shredded Kosher pork on a leinsamen roll and some local dark ale.

Ene Uran 638 Posting Virtuoso

Oh sweet Jesus, I had one too many beers. I read "Global Warning" and actually looked at this! I am sorry!

Ene Uran 638 Posting Virtuoso

According to the latest Zogby poll, 10% of Americans are giving President Bush's economic policy the thumbs up.

The other 90% are using a different finger.

Ancient Dragon commented: That's goooood :) +34
Ene Uran 638 Posting Virtuoso

If you have a headache, do what it says on the aspirin bottle: Take two, and KEEP AWAY FROM CHILDREN.

Ene Uran 638 Posting Virtuoso

Look at your code, what are your import statements? Usually they are at the start of the program code.

Ene Uran 638 Posting Virtuoso

MikeyFTW,
looks like you have to study up on Tkinter GUI programming.

Here is an introduction:
http://www.pythonware.com/library/tkinter/introduction/index.htm

In simple terms, create a frame/window/root, input through an Entry, action with a Button and output to a Label.

Ene Uran 638 Posting Virtuoso

riyadhmehmood, do not hijack somebody elses thread! Very bad manners. Start your own thread.

Ene Uran 638 Posting Virtuoso

Here is an example of using the Tkinter GUI toolkit to bring up a 5 second splash screen. All the info you want needs to be written into the picture itself, using one of the popular image editing utilities:

# create a splash screen, 80% of display screen size, centered,
# displaying a GIF image with needed info, disappearing after 5 seconds

import Tkinter as tk

root = tk.Tk()
# show no frame
root.overrideredirect(True)
width = root.winfo_screenwidth()
height = root.winfo_screenheight()
root.geometry('%dx%d+%d+%d' % (width*0.8, height*0.8, width*0.1, height*0.1))

# take a .jpg picture you like, add text with a program like PhotoFiltre
# (free from http://www.photofiltre.com) and save as a .gif image file
image_file = "LakeSplash.gif"
#assert os.path.exists(image_file)
# use Tkinter's PhotoImage for .gif files
image = tk.PhotoImage(file=image_file)
canvas = tk.Canvas(root, height=height*0.8, width=width*0.8, bg="brown")
canvas.create_image(width*0.8/2, height*0.8/2, image=image)
canvas.pack()

# show the splash screen for 5000 milliseconds then destroy
root.after(5000, root.destroy)
root.mainloop()

# your console program can start here ...
print "How did you like my informative splash screen?"
Ene Uran 638 Posting Virtuoso

LOL

but seriously, if there ever was a problem that should be solved by Perl... this is it.

look into Perl. this is the kind of problem it's designed to do. and can do it in about 3 lines of code.

Python does it with one line:

text = text.replace(' ', '')
Ene Uran 638 Posting Virtuoso

Shortly after Thomas Jefferson took office, he wrote the following about George Washington:
"Though an able commander, I presume the General knows little of diplomacy and tact. His manner is often rude and his mood is quite unstable."

Even though he only made it up to the rank of captain, you could say the same thiing about John McCain.

Ene Uran 638 Posting Virtuoso

I always wanted to know this;

Where does space end, and if it does not end, where does it go?

Space might just be a loop. But then, what is outside the loop?

Ene Uran 638 Posting Virtuoso

I just tried it with my old monitor. I threw it 12 feet and 7 inches. Should be an Olympic event!

Ene Uran 638 Posting Virtuoso

As if Bill's retirement will keep him away from microsoft.He has done a gr8 job to be fair. And as for the charity...supurb!! thats anyways small change for him even though its alot
He should give me charity money.lol

Good job Billy

I go along with that! Bill Gates had a vision and will keep going with it!

Ene Uran 638 Posting Virtuoso

What did the bra say to the hat?
"You go on ahead, while I give these two a lift."

Ene Uran 638 Posting Virtuoso

Lost time is never found again.

Ene Uran 638 Posting Virtuoso

Peanut butter sandwich with red currant jelly ( www.heroamerica.com ), coffee to drink.

Ene Uran 638 Posting Virtuoso

Something like this should do:

s = 'xxxxx - xxxxx'
space = ' '
nospace = ''
s = s.replace(space, nospace)
print s  # xxxxx-xxxxx
Ene Uran 638 Posting Virtuoso

I don't think the SND_PURGE flag is meant to work the way you interpreted it.

Ene Uran 638 Posting Virtuoso

One of the features of Python3 will be that the division operator / will give a float result ( // is used for integer divisions as usual ). You can use this feature now by importing the __future__ module. Test it out with this example:

# access Python3 features like / for float division

from __future__ import division

print "Enter a math statement like 355/113 or (2+3)/2 ..."
while True:
    result = input("Statement: ")
    print result
    if raw_input("Continue? (y, n)").lower() == 'n': break
Ene Uran 638 Posting Virtuoso

Starting with Python3 the / will be float division and // will be integer division. You can use these future feature already by importing the __future__ module:

from __future__ import division
print "Welcome to SCLMIP(Simple Calculator For Linux Made In Python)"
while True:
    equation = input("Equation: ")
    print equation
    if raw_input("Continue? (Y,N)").upper() == 'N': break
else:
    print "Exiting..."