Ene Uran 638 Posting Virtuoso

Whatever is on my Windows Vista works with the .chm files I have. I just want to know what the darn thing is actually called, for instance 'something.exe' rather than the nebulous 'Microsoft® HTML Help Executable'. I need the actual exe file to run the language specific chm help file from my programming editor.

Actually, a friend just told me that her Windows XP machine gives her the same dimwitted answer in the properties window. There's got to be an executable file somewhere that takes .chm files as argument.

Ene Uran 638 Posting Virtuoso

I can run the .chm files just fine by double clicking on them. I have a program that allows me to run a specific .chm help file, but I have to give it the actual executable for the .chm file.

Properties only lists:
Microsoft® HTML Help Executable
as the executable, but that is not the actual file.

Ene Uran 638 Posting Virtuoso

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

Ene Uran 638 Posting Virtuoso

You use return:

def get_color():
    color = raw_input("Enter the name of a color: ")
    # process it
    color = color.lower()
    return color

pcolor = get_color()
print pcolor
Ene Uran 638 Posting Virtuoso

Converting documents to PDF:
http://www.devshed.com/c/a/Python/Python-for-PDF-Generation/
uses The ReportLab Toolkit:
http://www.reportlab.org/downloads.html
with images also need the Python Imaging Library (PIL):
http://www.pythonware.com/products/pil

The problem is that you have to bring in the MS-Word document into python to process it. If you simply have to convert a MS-Word document, you can bring it into OpenOffice-Write (free from Sun) and export it from there to PDF.

Ene Uran 638 Posting Virtuoso

If you have a computer made for the US market, you most likely don't have char 0156 (a hex number) in your character set.

Also note that editors like DrPython, SPE and UliPad screw up unicode character sets in their output window. Use PyScripter or ConText to get at least some order into playing with unicode.

Ene Uran 638 Posting Virtuoso
Ene Uran 638 Posting Virtuoso

You could bundle your Python program with py2exe and then call that .exe file from your C++ program.

Ene Uran 638 Posting Virtuoso

I am using PyScripter more and more and really like the code completion, and the ease you can insert code templates.

For instance, hope it makes sense:

s = 'hello'
# Next line, the moment you type the period after s
# a code completion menu pops up
# with all the possible string functions.
# Here I doubleclicked on find.
# When I type the opening (  a popup hint comes up
# showing me what could go inside the find() function
# and more
ix = s.find('ll')
print ix

# Pressing ctrl/j brings up a template popup list
# for something like this
# Yes you can copy the result from the
# Pyscripter output/interpreter window
"""
my result -->
2
"""

One thing you have to be careful about is the use of running the code in memory (nice but dangerous) rather than from a saved file. Pyscripter has a tendency to quit unceremoniously with certain errors. If you didn't save a copy of your code, you lost it!

Ene Uran 638 Posting Virtuoso

LOL, I like to see the teacher's face if jimbox123 turns in slate's code as homework!

Ene Uran 638 Posting Virtuoso

Slate is right, his approach works with the old style class format:

>>> import types
>>> class Test: pass
... 
>>> t = Test()
>>> type(t) == types.InstanceType
True

But does not work with the new style class:

>>> import types
>>> class C(object): pass
... 
>>> c = C()
>>> type(c) == types.InstanceType
False
Ene Uran 638 Posting Virtuoso

My family used to go the end of August and the first part of December for the least crowds. It's expensive, but a lot of fun!

Ene Uran 638 Posting Virtuoso

Class instances have to be tested differently, since you also have to supply the class info (instance of what?):

>>> class Test:
...     pass
... 
>>> t = Test()
>>> type(t)
<type 'instance'>
>>> isinstance(t, Test)
True
>>>

If you use the new style class, this becomes more apparent:

>>> class Test(object):
...     pass
... 
>>> t = Test()
>>> type(t)
<class '__main__.Test'>
>>> isinstance(t, Test)
True
>>>
Ene Uran 638 Posting Virtuoso

I am curious what operating system you have. I have been trying to install PyQt4 on my Windows Vista machine and it seems to fail.

I downloaded PyQt-Py2.5-gpl-4.4.2-1.exe which is the Windows binary installer. It is supposed to contain everything needed for PyQt development except for Python itself:

PyQt
Qt (with database support for SQLite3 and ODBC)
Qt Designer
Qt Linguist
Qt Assistant
pyuic4
pylupdate4
lrelease
pyrcc4
QScintilla

However after the installation I get the notorious:
"ImportError: No module named PyQt4"
even though there is a PyQT4 folder and a bin subfolder with all the needed dll files in my Python Lib folder.

A shame, because PyQT sounds like and interesting GUI toolkit. Let me know what you did to make it work on your computer. If I get it to go, I can help you too.

More details, I downloaded:
http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py2.5-gpl-4.4.2-1.exe

Don't ask me how I did it, but I got it to go on my Windows Vista machine. I started with the premise that the MS mindset is magnanimously screwed up. So here is the solution:
The PyQT installation works on Windows Vista if you add the file qt.conf found in C:\Python25 after the installation to (oh my God, what are those MS folks thinking?):
C:\Users\User_Name\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\PyQt GPL v4.4.2 for Python v2.5

You have to use your own User_Name!

Ene Uran 638 Posting Virtuoso

The only reason I made a commercial for American Express was to pay for my American Express bill.
- Peter Ustinov

Ene Uran 638 Posting Virtuoso

Most Egyptians, 3000 years ago, lived only to an age of around 30 years.

Ene Uran 638 Posting Virtuoso

I too was trying to get the Eric IDE to go, but failed in my PyQT4 installation. See:
http://www.daniweb.com/forums/post618106-2.html

It may be my Windows Vista OS that throws in its childish security blocks on the installation.

Ene Uran 638 Posting Virtuoso

I am curious what operating system you have. I have been trying to install PyQt4 on my Windows Vista machine and it seems to fail.

I downloaded PyQt-Py2.5-gpl-4.4.2-1.exe which is the Windows binary installer. It is supposed to contain everything needed for PyQt development except for Python itself:

PyQt
Qt (with database support for SQLite3 and ODBC)
Qt Designer
Qt Linguist
Qt Assistant
pyuic4
pylupdate4
lrelease
pyrcc4
QScintilla

However after the installation I get the notorious:
"ImportError: No module named PyQt4"
even though there is a PyQT4 folder and a bin subfolder with all the needed dll files in my Python Lib folder.

A shame, because PyQT sounds like and interesting GUI toolkit. Let me know what you did to make it work on your computer. If I get it to go, I can help you too.

More details, I downloaded:
http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py2.5-gpl-4.4.2-1.exe

Ene Uran 638 Posting Virtuoso

You may have to use class methods __getstate__ and __setstate__ to pickle your type of class correctly.

Ene Uran 638 Posting Virtuoso

Well, if you get Eric to work, let the rest of us know what you did.

Ene Uran 638 Posting Virtuoso

I never believed in Santa Claus because I knew no white dude would come into my neighborhood after dark.
-- Dick Gregory

Ene Uran 638 Posting Virtuoso

First pastor Mike Huckabee in front of the National Rifle Association suggesting that someone could have shot Obama, and then Hillary Clinton saying she was staying in the race because someone could shoot/assassinate Obama, is this a sick country or something?

Ene Uran 638 Posting Virtuoso

They are pretty much useless if they do nothing else other than to boost up ones 'hard drive' temporarily.

If there is nothing on the 'hard drive', no drug will help, not even the usual caffeine (most popular energy drinks), hyper-breathing (oxygen) and tuna diet.

Ene Uran 638 Posting Virtuoso

A husband and wife went to the marriage counselor. When asked what the problem was, the wife went into a passionate, painful tirade listing every problem they ever had in the 20 years of marriage.

She went on and on and on: neglect, lack of intimacy, emptiness, loneliness, feeling unloved and unlovable, an entire laundry list of unmet needs she had endured over the course of their long marriage.

Finally, after allowing this to go on for a sufficient length of time, the counselor got up, walked around the desk and, after asking the wife to stand, embraced and kissed her passionately, as her husband watched with a raised eyebrow. The woman shut up and quietly sat down as though in a daze.

The counselor turned to the husband and said, "This is what your wife needs at least three times a week. Can you do this?"

The husband thought for a moment and replied, "Well, I can drop her off with you on Mondays and Wednesdays, but on Fridays, I go fishing."

Ene Uran 638 Posting Virtuoso

21 US states allow first cousins to marry.

Ene Uran 638 Posting Virtuoso

A road side sign by a road side sign agency:
"A BUSINESS WITH NO SIGN IS A SIGN OF NO BUSINESS"

Ene Uran 638 Posting Virtuoso

The guy next door is a retired Airforce officer, his black Hummer has this bumper sticker:
"We don't drop boms to kill, we drop bombs to stay alive."

Ene Uran 638 Posting Virtuoso

There is a simplifying wrapper for pygame called gasp. You need pygame installed first for this to work:

# using module gasp to draw an arc, a box, plots and circles
#
# info: GASP (Graphics API for Students of Python)
# A library built on pygame that enables absolute beginners to 
# write 1980's style arcade games as an introduction to python.
#
# free download from:
# http://dev.laptop.org/pub/gasp/releases/SOURCES/python-gasp-0.1.1.tar.bz2
# unpack python-gasp-0.1.1.tar.bz2 and copy the 'gasp' subdirectory 
# into your python path eg. C:\Python25\lib\site-packages\gasp
#
# you need pygame installed for gasp to work
# free download from : http://www.pygame.org/

from gasp import *

# rgb color tuples
black = 0, 0, 0
blue = 0, 0, 255
brown = 165, 42, 42
green = 0, 255, 0
orange = 255, 165, 0 
red = 255, 0, 0
white = 255, 255, 255
yellow = 255, 255, 0

begin_graphics()

t = Text("Huston, we have a problem!", (100,420), color=blue, size=40)

# Line(from (x, Y), to (x, y))
q1 = Line((30, 400), (500, 400), color=black)
q2 = Line((30, 395), (500, 395), color=yellow)
q3 = Line((30, 390), (500, 390), color=black)

# Arc(center (x, y), radius, degrees_start, degrees_end)
# degrees relative to x axis (horizontal)
a = Arc((100,200), 100, 30, 330, filled=True, color=red)

# Box(lower_left_corner (x, y), width, height)
b1 = Box((100, 100), 200, 200, color=blue, thickness=5)
b2 = Box((10, 50), 500, 20, filled=True, color=brown)

# Circle(center (x, y), radius)
c1 = Circle((420,200), 100, filled=True, color=green)
c2 = …
Ene Uran 638 Posting Virtuoso

It is better to aim at perfection and miss, than to aim at imperfection and hit it.

Ene Uran 638 Posting Virtuoso

$12 a gallon comes out high because the US Dollar is so devalued compared to the British Pound. Also the US Gallon is 3.8 liters. Even though $9 per gallon for petrol in the US would raise some eyebrows.

Ene Uran 638 Posting Virtuoso

Peanut butter and blueberry jelly on a sourdough toast.

Ene Uran 638 Posting Virtuoso

Germany during WW2 send many of their most educated people to the frontline because the ultra rightwing government in charge in those days did not like well educated people.

Ene Uran 638 Posting Virtuoso

I don't think it has much to do with the size of the list, you are simply going past the number of indexed elements. Look at this example:

my_list = [1, 2, 3, 4]
print my_list[4]  # IndexError: list index out of range
Ene Uran 638 Posting Virtuoso

Assuming that myfile.txt exists, this should work just fine. Works for me.

myfile = open('myfile.txt', 'r').read()
print "\n", myfile
Ene Uran 638 Posting Virtuoso

Chicken wings, bread and wine.

Ene Uran 638 Posting Virtuoso

If 3 out of 5 people suffer from diarrhea, does that mean that 2 out of 5 enjoy it?

Ene Uran 638 Posting Virtuoso

Barack Obama: Rockstar. Motivational Speaker. President???

Are these guys for real? What a bundle of poppycock. Appeaser is the new mud word to fling around for someone that likes to start a dialog. Bush's remark was very calculated. I am sure he had no idea about the actual historical event he was referencing.

Here are some more of those unpatriotic appeasers:
JFK talked to the Russians about Cuba.
Nixon talked to the Chinese about improved relations.
Reagan talked to the Russians about nuclear missiles.

Not talking to your perceived enemy gets you into wars.

Ene Uran 638 Posting Virtuoso

Here is a very basic text editor using the wxPython GUI toolkit. Your mission will be to add some features like find, replace, wordcount etc. to it:

# the start of a small text editor with file load and save menu
# notice that the wx.TextCtrl() surface has already some advanced
# features: 
# you can select text, right click to cut, copy and paste etc.

import os
import wx

# pick unique ID values
ID_ABOUT = 101
ID_LOAD = 102
ID_SAVE = 103
ID_EXIT = 110

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size = (500, 300))
        self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
        # statusBar at the bottom of the window
        self.CreateStatusBar() 
        # set up the menu
        filemenu= wx.Menu()
        filemenu.Append(ID_ABOUT, "&About"," Information about this program")
        filemenu.Append(ID_LOAD,"File&Load", " Load a text file")
        filemenu.Append(ID_SAVE,"File&Save", " Save a text file")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
        # create the menubar
        menuBar = wx.MenuBar()
        # adding the "filemenu" to the MenuBar
        menuBar.Append(filemenu,"&File")
        # adding the MenuBar to the Frame content 
        self.SetMenuBar(menuBar)  
        # attach the menu-event ID_ABOUT to the method self.OnAbout
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        # attach the menu-event ID_OPEN to the method self.OnOpen
        wx.EVT_MENU(self, ID_LOAD, self.OnLoad)
        # attach the menu-event ID_SAVE to the method self.OnSave
        wx.EVT_MENU(self, ID_SAVE, self.OnSave)
        # attach the menu-event ID_EXIT to the method self.OnExit
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)
        # display the frame   
        self.Show(True)

    def OnAbout(self, e):
        """ the about box """
        about = wx.MessageDialog( self, " A very simple editor \n"
            " using the wxPython GUI toolkit", "About Simple …
Ene Uran 638 Posting Virtuoso

Why do you have such goofy indentations?

Ene Uran 638 Posting Virtuoso

Here is an example to make the tk window disappear:

import Tkinter as tk
import tkFileDialog

root = tk.Tk()
# show file dialog without Tkinter window
root.withdraw()

filename = tkFileDialog.askopenfilename()

print filename

To see the code tags around this code, temporarily click on the "REPLY W/QUOTE" button.

Ene Uran 638 Posting Virtuoso

You must not have installed tkSnack properly. For instance open the zip file snack2210-py.zip and extract file tkSnack.py to
C:\Python24\Lib
and the folder snacklib to
C:\Python24\tcl

Ene Uran 638 Posting Virtuoso

2012 may not be the end of the world, but has been mentioned as the year when demand for oil will exceed possible new exploration for oil resources. A situation oil folks call the "Peak Oil".

So what do you think the price of petrol will be in the US in 2012? If it's close to $20 a gallon it would be the end of the world!

Ene Uran 638 Posting Virtuoso

Men are simple things. They can survive a whole weekend with only three things: beer, chips and batteries for the remote control.

Ene Uran 638 Posting Virtuoso

Michael Moore was so far the heaviest director to win top honors at the Cannes Film Festival.

Ene Uran 638 Posting Virtuoso

George Bush's Hurricane Katrina debacle has provided helpful lessons to the Chinese leadership on how not to do disasters. China's leaders will doubtless have noticed the extent to which, as in Bush's case, fumbling at the top at a time of national crisis can destroy political reputation and legitimacy.

Ene Uran 638 Posting Virtuoso

Dear God: "I don't believe in those annoying giant red HSBC popup ads!"

Besides the advertised 3.05% interest on your savings (even before taxes) puts you way below the inflation rate. You are losing money in a big way!

Ene Uran 638 Posting Virtuoso

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?

Ene Uran 638 Posting Virtuoso

I am not quite sure what you mean with store, If you mean store in a string, there are these ways:

a=['city','village','town','capital']
a1=len(a)
a2=range(a1)
s = ""
for x in a2:
    a3=a[x]
    print a3
    s += a[x]

print s  # cityvillagetowncapital

Much simpler:

a=['city','village','town','capital']
s = ""
for x in a:
    s += x

print s  # cityvillagetowncapital

Add a space separator:

a=['city','village','town','capital']
s = ""
for x in a:
    s += x + " "  # add a space

print s  # city village town capital

Even simpler:

a=['city','village','town','capital']
s = " ".join(a)
print s  # city village town capital

Note: I hope Dani does not think those annoying HSBC popup ads are an improvement.

Ene Uran 638 Posting Virtuoso

In your scipy directory there is the package init file __init__.py and there also should be a __config__.py file. If not, you may have to reinstall or run the setup.py program.

python setup install
Ene Uran 638 Posting Virtuoso

Friendship is a ship big enough to carry two in good weather, but only one in bad weather.