bumsfeld 413 Nearly a Posting Virtuoso

Your Python installation usually includes the Tkinter GUI toolkit. Tkinter can do the things you want to do.

bumsfeld 413 Nearly a Posting Virtuoso

Chicken Kiev with fresh baked bread.

bumsfeld 413 Nearly a Posting Virtuoso

Why do Conservatives think that being a Muslim or Arab is so bad?

bumsfeld 413 Nearly a Posting Virtuoso

Most 'toy guns' that children shoot are in their video games. Much more realistic since much blood, brain matter, bones and guts are visually spilled.

Even some nations' military are training their soldiers on video games now.

bumsfeld 413 Nearly a Posting Virtuoso

Great site!

Read in the news:
English-speaking French Foreign Minister Bernard Kouchner was quoted saying:
"Israel could eat Iran if it wanted to!"

What he meant to say:
"Israel could hit Iran if it wanted to!"

(the h is silent in French)

You are funny girl!

A: "How many programmers does it take to screw in one light bulb?"
Q: "Two programmers and it better be very large light bulb!"

bumsfeld 413 Nearly a Posting Virtuoso

Blaming a bunch of bad mortgage loans at US institutions Fannie Mae and Freddie Mac for the whole worldwide financial crisis is rather simple-minded. The main cause are loans made between investment banks all over the world, in most cases totally unregulated by any of the governments involved.

Now that makes sense! The peoples of Europe certainly don't blame fred and fanny for their financial crisis! McCane seems to be the only one that uses this simpleton argument.

bumsfeld 413 Nearly a Posting Virtuoso

Bush is poor excuse for President, but yet 20% of voters still support him. Probably the same 20% that will support Sara Palin, fraud or not. No sense to argue any further.

bumsfeld 413 Nearly a Posting Virtuoso

I find it strange that Obama is one unknown stranger, possibly a muslim or terrorist, after two years of running for president, being looked over by thousands of experts. On the other hand Palin became "one of us" after less than two hours, coming from the unknown wilderness of Alaska.

bumsfeld 413 Nearly a Posting Virtuoso

One company manages France's 59 nuclear power plants. These plants produce 88% of France's electrical power. The design is optimized for safety and standardized mostly around 3 sizes of pressurized water reactors.

We have the lowest electricity cost in Europe. Strangely enough France exports large amounts of electricty to Germany, one country that stopped all new nuclear power generation because of their hysterical Greens.

I think all the power plants have been built by one French manufacturer, who presently is building large number of them for China.

bumsfeld 413 Nearly a Posting Virtuoso

This was not debate but endless repetition of silly catch-sentences.

Maverick party? The phrase "the American economy is fundamentally strong!" translates into "the American worker is the best!". Then why have over 500,000 of those super workers lost their job this year alone? The war in Iraq has been won, but we won't leave? etc. etc. etc.

bumsfeld 413 Nearly a Posting Virtuoso

Hey, lardy, you forgot me! Grr.

Lardy only picked the ones that made his hot chocolate taste even better this morning!

bumsfeld 413 Nearly a Posting Virtuoso

There are variety of cursors available using the wx.StockCursor() in wxPython:

# a look at cursors and wx.StockCursor()

import wx

class MyFrame(wx.Frame):
    """create a color frame, inherits from wx.Frame"""
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, wx.ID_ANY, "Left click the mouse",
            size=(500, 300))
        self.SetBackgroundColour('yellow')
        self.count = 0
        # just to show you how to set it, actually the default cursor
        self.SetCursor(wx.StockCursor(wx.CURSOR_ARROW))
        # bind mouse left click event
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown)

    def onLeftDown(self, event):
        """left mouse button is pressed"""
        # get (x, y) position tuple
        pt = event.GetPosition()
        # put cursor globals in as strings so the name can be shown
        cursors = ['wx.CURSOR_SPRAYCAN', 'wx.CURSOR_NO_ENTRY', 'wx.CURSOR_BULLSEYE', 
            'wx.CURSOR_CROSS', 'wx.CURSOR_HAND', 'wx.CURSOR_IBEAM', 
            'wx.CURSOR_MAGNIFIER', 'wx.CURSOR_PENCIL', 'wx.CURSOR_RIGHT_ARROW', 
            'wx.CURSOR_QUESTION_ARROW', 'wx.CURSOR_WAIT', 'wx.CURSOR_ARROWWAIT',
            'wx.CURSOR_PAINT_BRUSH', 'wx.CURSOR_SIZING']
        s = "cursor = %s   at point %s" % (cursors[self.count], str(pt))
        self.SetTitle(s)
        # use eval() to get the integer value back
        int_val = eval(cursors[self.count])
        self.SetCursor(wx.StockCursor(int_val))
        self.count += 1
        if self.count >= len(cursors):
            self.count = 0


app = wx.App(0)
MyFrame(None).Show()
app.MainLoop()
bumsfeld 413 Nearly a Posting Virtuoso

I watched the ALSO debate last night and must say that Miss Palin made old McCain look real good!

She exclusively used also, but could have used:
too
likewise
besides
as well
in addition
additionally
similarly
in like manner
along with
more than that
au reste
over and above
thereto
ditto
moreover
furthermore
plus
to boot .......

bumsfeld 413 Nearly a Posting Virtuoso

Out of the corner of my tearful eye I noticed that I made my post #1000!

I am elated, exhilarated, jubilant, overjoyed, ecstatic and happy!

Time to get that 12 year old wine out of the cellar.

Salem commented: Congrats! and welcome to the yellow star club :) +22
Ancient Dragon commented: Congratulations for being a valuable DaniWeb contributor :) +36
William Hemsworth commented: Well done! +4
bumsfeld 413 Nearly a Posting Virtuoso

Sarah clearly won the ALSO debate. Biden was factual and boring, she was also sparkling fresh, and as also folksy as also Bush used to be.

bumsfeld 413 Nearly a Posting Virtuoso

Here is simple example using Tkinter GUI toolkit that is usually included with Python:

# using geometry manager place() for absolute layouts

import Tkinter as tk

def connect():
    "make your connection"
    # your connection code here
    # ...
    root.title("Connected!")  # test

# the root window
root = tk.Tk()

# command --> does function connect when mouse is clicked
button = tk.Button(root, text='Connect', command=connect)
# position the button at points x, y
# (x=0, y=0 is upper left corner of root area)
button.place(x=90, y=10, width=100, height=20)

# the event loop checks on mouse action
root.mainloop()
bumsfeld 413 Nearly a Posting Virtuoso

GrimJack, in the video did you see that nude chick on the beach?

bumsfeld 413 Nearly a Posting Virtuoso

You are right! War is serious business, and this one is being run by amateurs at the top.

bumsfeld 413 Nearly a Posting Virtuoso

No mindreaders here, so let us know what data stream looks like.

bumsfeld 413 Nearly a Posting Virtuoso

You are right, there are many ways.

'''
let's assume your data file "7to4.txt" would look like this:
1,10002,0,11:18,11:18,0,1,444,1
4,1.5
5,1.5
6,0,444,444,10002
7,0,1.5
1,10003,0,11:34,11:34,0,1,444,1
4,1.5
5,1.5
6,0,444,444,10003
7,0,1.5
1,10004,0,11:39,11:39,0,1,444,1
4,7.25
5,7.25
6,0,444,444,10004
7,0,7.25
'''

new_string = ""
# each line is string so you can use string functions
for line in file("7to4.txt"):
    if line.startswith('7'):
        # replace first 7 with 4
        line = line.replace('7', '4', 1)
    new_string += line

print new_string
bumsfeld 413 Nearly a Posting Virtuoso

Sometimes you want to change the colour of the widget as the mouse pointer moves over it. Here is the wx.Button() code example:

# change the color of the button as the mouse pointer moves over it

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(300, 100))
        # panel needed to size the single button properly
        panel = wx.Panel(self, wx.ID_ANY)

        self.button = wx.Button(panel, wx.ID_ANY, 
            'move the mouse pointer over the button',
            pos=(10, 10), size=(-1, -1))
        self.button.SetBackgroundColour('green')

        # bind mouse events to actions
        self.button.Bind(wx.EVT_ENTER_WINDOW, self.mouse_over)
        self.button.Bind(wx.EVT_LEAVE_WINDOW, self.mouse_not_over)
        self.button.Bind(wx.EVT_BUTTON, self.button_clicked)

    def mouse_over(self, event):
        self.button.SetBackgroundColour( 'yellow')
        #self.button.Refresh()

    def mouse_not_over(self, event):
        self.button.SetBackgroundColour( 'green')
        #self.button.Refresh()
    
    def button_clicked(self, event):
        self.SetTitle("button has been clicked")


app = wx.App(0)
MyFrame(None, 'show mouse-over event').Show()
app.MainLoop()
bumsfeld 413 Nearly a Posting Virtuoso

There is usually info in the MS-HTML-Help file
wx.chm
if wxPython does not have one particular feature.

Also look at:
http://wiki.wxpython.org/index.cgi/FrontPage
This is the API ref, very extensive:
http://prdownloads.sourceforge.net/wxpython/wxPython-newdocs-2.8.8.1.tar.bz2

bumsfeld 413 Nearly a Posting Virtuoso

With DEVCPP this works just fine:

// obtain square root

#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
   double s, a, b, c, area;

   s = 5.0;
   a = b = c = 1.5; 
   area = sqrt(s*(s-a)*(s-b)*(s-c));
   
   cout << "sqrt(" << s*(s-a)*(s-b)*(s-c) << ") = " << area << '\n';

   cin.get(); // wait
   return EXIT_SUCCESS;
}
bumsfeld 413 Nearly a Posting Virtuoso

Camembert cheese, just the right age, multgrain fresh bread and a glass of fine Bordeaux. How can life be any better?

bumsfeld 413 Nearly a Posting Virtuoso

The Pope dies and, naturally, goes to heaven where he's met by one reception committee of angels. After whirlwind tour, The Pope is told that he can enjoy any of the myriad recreations available.

He decides that he wants to read all of the ancient original text of the Holy Scriptures, so he spends the next eon or so learning the languages.

After becoming the linguistic master, he sits down in the library and begins to pour over every version of the Bible, working back from the most recent "Easy Reading" to the original handwritten script.

The angel librarian hears one loud scream, and goes running toward its source only to find the Pope huddled in his chair, shaking and crying.

"The R! They left out the R!"

"What do you mean?" the angel librarian asks.

After collecting his wits, the Pope sobs again, "The word was supposed to be CELEBRATE!"

bumsfeld 413 Nearly a Posting Virtuoso

Why waste a perfectly fine computer on scum like that? I say heads off with a rather dull guillotine!

bumsfeld 413 Nearly a Posting Virtuoso
bumsfeld 413 Nearly a Posting Virtuoso

Seems to me like a nice technique. It is steganography, right?

As far as I understand, steganography would be to change each byte of image file just one small amount, so the picture essentially looks the same. Comparing it with the original picture would reveal the secret message hidden in the small changes.

So, I guess I can assume that md5 is not reversible, right?

That is the idea, and the reason md5 is used for encrypting the password itself. Encryption of the text itself can be donw with a number of Python tools. Very simple one would be XOR encryption against the looped password. I think there is code snippet under Python for that. Check out:
http://www.daniweb.com/code/snippet688.html

bumsfeld 413 Nearly a Posting Virtuoso

Something like this will do:

for line in wordlistfile:
    wordlist.append(line.strip())
bumsfeld 413 Nearly a Posting Virtuoso

Colorado and Hawaii are the only two states in the United States where all the water flows out of the state.

Love that Coors stuff!

bumsfeld 413 Nearly a Posting Virtuoso

I'm rich. I have more than most people. I've got a wonderful family made up of the three cutest kids I've ever seen and a wife that just adores me. My family is very healthy, I have a career and a job to fill that career, health insurance for my entire family. I love playing with my kids and have the extra time to do so every day.

And here's the kicker, even though I am so rich, I still live a very simple lifestyle. :cool: :cool: :cool:

Just like me! Except I have three cats.

bumsfeld 413 Nearly a Posting Virtuoso

The US government is sending you 1 Billion Dollars, the check is in the mail. :)

How do you apply for this?

bumsfeld 413 Nearly a Posting Virtuoso

Wow Sarah Palin without her makeup on!
._._._

... and she still looks soooo prrrrrrrrretty!

As one outsider I am confused, does Palin run against Obama? What happened to McCain?

bumsfeld 413 Nearly a Posting Virtuoso

PDS Reference Guide

Amazing, of all those articles only one is wrong!

Dave Sinkula commented: bumsfeld: post-partisan polemicist! +17
bumsfeld 413 Nearly a Posting Virtuoso

Current News:
"Police just arrested one group of people in Denver that had sharpshooter's guns and plans to kill Obama on Thursday!"

Oh how sick! Might as well vote for John McCain!

bumsfeld 413 Nearly a Posting Virtuoso

Do you think "Cell Phone Throwing" and "Computer Throwing" should become Olympic sports?

bumsfeld 413 Nearly a Posting Virtuoso

P. J. O'Rourke wrote:
"America wasn't founded so that we could all be better. America was founded so we could all be anything we damned well pleased."

Actually, he wrote that after visiting France.

bumsfeld 413 Nearly a Posting Virtuoso

For small country France did pretty well!
Would have done better, but the Chinese food is not rich enough!

bumsfeld 413 Nearly a Posting Virtuoso

Global Warming, I believe it when they open up the beaches on the South Pole for the tourists.

bumsfeld 413 Nearly a Posting Virtuoso

We even care for the opinion of those we don't care for.

bumsfeld 413 Nearly a Posting Virtuoso

There are plenty of rich old folks that don't know!

Do rich old folks make good leaders?

bumsfeld 413 Nearly a Posting Virtuoso

Just taking hasty look, I would say no because py2app needs to include some files specific to the MAC OS. You don't have those on your Windows PC.

bumsfeld 413 Nearly a Posting Virtuoso

The closest thing would be jython:
http://www.jython.org/

bumsfeld 413 Nearly a Posting Virtuoso

Simply use this:

# list all the modules Python currently knows about ...
help("modules")
bumsfeld 413 Nearly a Posting Virtuoso

At first blush i would say this might do:

# compare these two list set and convert
# w_b into [0.5, 0, 0.5, 0]

a = ['a', 'b', 'c', 'd']
w_a = [0.25, 0.25, 0.25, 0.25]

b = ['a', 'c']
w_b = [0.5, 0.5]


for ix, aa in enumerate(a):
    if aa not in b:
        w_b.insert(ix, 0)
        
print w_b  # result --> [0.5, 0, 0.5, 0]

Also note that you can combine two related lists in one container:

# combine two lists to show their relationship better

a = ['a', 'b', 'c', 'd']
w_a = [0.25, 0.25, 0.25, 0.25]

# list of (name, weight) tuples
print zip(a, w_a)  # [('a', 0.25), ('b', 0.25), ('c', 0.25), ('d', 0.25)]

# dictioary with name:weight pairs
print dict(zip(a, w_a)) # {'a': 0.25, 'c': 0.25, 'b': 0.25, 'd': 0.25}

BTW, dictionaries are much faster way to look things up then indexing two separate related lists:

a = ['a', 'b', 'c', 'd']
w_a = [0.25, 0.25, 0.25, 0.25]

b = ['a', 'c']
w_b = [0.5, 0.5]

dict_a = dict(zip(a, w_a))
dict_b = dict(zip(b, w_b))

for k, v in dict_a.items():
    if k not in dict_b.keys():
        dict_b[k] = 0

print dict_b  # {'a': 0.5, 'c': 0.5, 'b': 0, 'd': 0}
bumsfeld 413 Nearly a Posting Virtuoso

On Google map the whole place is simply blank! Why is this place so important?

bumsfeld 413 Nearly a Posting Virtuoso

I have other W one:
"I wasn't happy when we found out there wasn't weapons in Iraq."
(from our champ's mouth during the 2nd presidential debate)

bumsfeld 413 Nearly a Posting Virtuoso

This T. Boone Pickens must be quite one man! I have seen him on the financial channels, and was impressed with his foresight and exeptional common sense.

Let's face it, the US imports most of its oil from some rather unstable countries. On top of that offshore platforms are very sensitive and unstable to frequent hurricanes. I would think it should be important to free oneself from such predicament.

Why doesn't he run for president?

bumsfeld 413 Nearly a Posting Virtuoso

A wonderful achievement Ene! The drinks are on the house!

--- 966 for me right now ---

bumsfeld 413 Nearly a Posting Virtuoso

I eat good helping of quiche Lorraine every day, it keeps me from programming.