richieking 44 Master Poster

Simple transparent overlaying image

import Image

handle = Image.open("fd.png")## Your first image file name

handle.putalpha(30)
handle.save("bv.png")
df=Image.open("bv.png")
dd =Image.open("i.jpg") ## Put your second image file name here
df.paste(dd,(100,200))
df.save("gg.png")

This is more simple :)

richieking 44 Master Poster

And note that .project is a hidden file. you need to turn on view hidden file to see it ok?
:)

richieking 44 Master Poster

And keep trying. Dont give up. ;)

richieking 44 Master Poster

Go here for what you needhttp://pyqrcode.sourceforge.net/

richieking 44 Master Poster

why would anyone wanna store an entire file content into a py object??

what about the size is about 4mb?? or 4gig?? Its just not a good idea.

Can you explian further why you need that and maybe we can advice/help you with something more useful...

richieking 44 Master Poster

Do this....

cursor.execute("INSERT INTO main12 VALUES(?,?)",(self.temp,self.entry2))
richieking 44 Master Poster

ow sorry... do this.....

result = []
for x in range(len( Flist1)):
     result.append(Flist1[x]-Flist2[x])
richieking 44 Master Poster

Convert the list values to int/float data type. Then it will be easy to work with them. Eg....

Flist1 = [float(x) for x in f1]
Flist2 =[float(x) for x in f2]

Now you can check for the diff. Btwn the lists.

result = []
for x in len( Flist1):
     result.append(Flist1[x]-Flist2[x])

Coming from my htc phone. Hope you get the idea :)

richieking 44 Master Poster

Like snippsat said. If you need to parse html/php page you will need beautifulsoup or the hard way using regex.
The choice is yours. :)

richieking 44 Master Poster

Shodow14l be friendly ok?

richieking 44 Master Poster

We are here to help with the homework . You just show a little effort and you are done. :)

richieking 44 Master Poster
s = "abc def ghi  jkl"
Print("\t".join(s.split())

Or

print("Hello \t world")
richieking 44 Master Poster

Are you sure the cgi diractory is configured well?
what is the owner and user group,...?

1.Its apache the owner of this directory??
2. Can you access a different cgi script from the dir.
3. Have you configured apahce conf well?

richieking 44 Master Poster

well explained buddy. :)

richieking 44 Master Poster

with better check with unique number. I think its not a good idea using enumerate function. Since enumearte repeates the number once new directory of files/ data in called.
I use anydbm alot and i think the best way is to use a counter with a dict. Then you check with the last dict call incrementing by 1 and use that for next key.

import anydbm


ddf = anydbm.open("ns.cdx",'r')

unique =  len(ddf.keys())


db =    anydbm.open("ns.cdx",'c')
for x in range(300):
    for y in reversed(range(1,4)):
       db[str(unique)]    =   str(y)
       unique = int(unique)
       unique  +=   1

print("Key  | Values \n ")
print "="*50
for x in ddf.keys():
    print x ,":", ddf[x]
db.close()
ddf.close()

from my htc phone. hope you get my idea ;)

richieking 44 Master Poster

All these scripts will start a new python instance. I think there must be a well developed scripts that check to see that a script instance has termiated before starting a new one.

However maybe the poster does not need this. just give a shout if needed :)

richieking 44 Master Poster

post the error code please

richieking 44 Master Poster

but i dont see any prolem with binding a button to self.
Infact i think its a good idea. Well not to start te holy war here but but that is my view

self.Bind(wx.EVT_BUTTON, self.OnSubmit, self.sendButton)

have alot of advantages....

richieking 44 Master Poster

More user friendly :)

def prompt(acts):
    while True:
        print """
              Please select one of the choices\n
              ==================================\n\n
              north\t south\n
              east\t west\n"""
            
        m = input("choice please: ")
        message = m.lower()[0]
        if message == "n":
            acts['north']
            break

        elif message == "e":
            acts['east']
            break

        elif message == "s":
            acts['south']
            break
        
        elif message == "w":
            acts['west']
            break
        else:
            print('Illegal option "%s"'%m)
richieking 44 Master Poster

You must chmod cgi scripts to 0755. Cgi's only works with that permission. ok?

:)

richieking 44 Master Poster

i gave you an idea. I dont use tk. but that should be how the algo should go. I can promise you that.
:)

richieking 44 Master Poster

or this.........

a = a= [(x+2,x*2) for x in range(1,300)]

And plot some graph with it ;)

richieking 44 Master Poster

idle just got so many problems. Even on the linux box like ubuntu.
You cant rely on idle gui.
Thats a fact.!

richieking 44 Master Poster

translate swedish to english using google translate and post that. ok?

richieking 44 Master Poster

why dont you try pyqt forum my friend. :)

richieking 44 Master Poster

pickle works like any other DB if you know how to use it very well.

You can save the file into a pckle and provide its it by incrementing the entries.

If you are new with python or having problem with pickle, I recommend anydb module for you which comes as a standard instalation with python.The module works like a dict.

from my HTC phone. :)

richieking 44 Master Poster

can you pls put your code into the code tags
:)

richieking 44 Master Poster

is this tk?

richieking 44 Master Poster

Nice one Gris. You are a teacher
:)

richieking 44 Master Poster

You can import the wx module into you code.

implemet the class of wx.grid. and call it into your Tkinter app.
One thing you must be carefule is to destroy the wx.grid before you call the close/destroy else you will have a crash in your app.

eg.....

def OnClose(self,event):
   self.grid.Destroy() ## say for wx Grid
   self.Destroy()    ## say for tK

And you should be fine :)

richieking 44 Master Poster

When lis pop. it removes the item from the stack.

Take it like you got items ...

llist = [1,2,3,4,5,6,7,]
llist.pop(3)
##
removes  : 4th item

The pop means give out. So when you give out, you dont still have that.
Like you cant eat your cake and have it stuff. :)
Hope you get the idea.....

richieking 44 Master Poster

Just save the path to the movie file into the database. Then you call the movie name from the data base by splitting the path. eg...

filename= pathtofile.split("/")[-1].split(".")[0]

Then you get the filename
:)

richieking 44 Master Poster

At least you show some appreciation by upvoting or something before asking for some more my friend.
:)

richieking 44 Master Poster

You can also use re to remove all characters with the W flag.
:)

richieking 44 Master Poster

Gris you forgot about provideing the first word.

line[0]

Nice job mate :)

richieking 44 Master Poster

That should have worked 100% for you. There must be somthing again not right with your code. You can post all your code for checkup.
:)

richieking 44 Master Poster

Pay attention to this and how its implemented please
:)

element_list = ["H.jpg","He.jpg","Li.jpg"]
        for i in range(len(element_list)):
            image_id = int(i+1)
            image_current = wx.Image("/Applications/PeriodicTable/ButtonBitMap/%s" % element_list[i], wx.BITMAP_TYPE_ANY).ConvertToBitmap()
            current = wx.BitmapButton(self,id=image_id,bitmap=image_current,style=wx.BORDER_NONE)
            main.Add(current,1)
            self.Bind(wx.EVT_BUTTON,self.OnButtonClick,current) ## add thiss line
     def OnButtonClick(self,event): # And this is how you checked for the pressed button
         ButtonId=event.GetId()     # And you respond to the actions in the if's
         if(ButtonId==1):
             pass
         if(ButtonId==2):
             pass
richieking 44 Master Poster

you will need pickle/anydb modules to save you words aginst a key. Thus for easy lookup.
:)

richieking 44 Master Poster

what module are you using?

self.request.get('path')

means nothing

richieking 44 Master Poster

You should be fine with this
This will print to a fie if you got no printer in place
:)

import wx
import os.path


class MainWindow(wx.Frame):
    def __init__(self, filename='noname.txt'):
        super(MainWindow, self).__init__(None, size=(400,200))
        self.filename = filename
        self.dirname = '.'
        self.CreateInteriorWindowComponents()
        self.CreateExteriorWindowComponents()
        self.log= open("foo.log",'w+')
        
    def CreateInteriorWindowComponents(self):
        ''' Create "interior" window components. In this case it is just a
            simple multiline text control. '''
        self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)

    def CreateExteriorWindowComponents(self):
        ''' Create "exterior" window components, such as menu and status
            bar. '''
        self.CreateMenu()
        self.CreateStatusBar()
        self.SetTitle()

    def CreateMenu(self):
        fileMenu = wx.Menu()
        for id, label, helpText, handler in \
            [(wx.ID_ABOUT, '&About', 'Information about this program',
                self.OnAbout),
             (wx.ID_OPEN, '&Open', 'Open a new file', self.OnOpen),
             (wx.ID_SAVE, '&Save', 'Save the current file', self.OnSave),
             (wx.ID_SAVEAS, 'Save &As', 'Save the file under a different name',
                self.OnSaveAs),
                
                (wx.ID_PRINT, '&Print', 'Print the current document',
                self.OnPrint),
             (None, None, None, None),
             (wx.ID_EXIT, 'E&xit', 'Terminate the program', self.OnExit)]:
            if id == None:
                fileMenu.AppendSeparator()
            else:
                item = fileMenu.Append(id, label, helpText)
                self.Bind(wx.EVT_MENU, handler, item)

        menuBar = wx.MenuBar()
        menuBar.Append(fileMenu, '&File') # Add the fileMenu to the MenuBar
        self.SetMenuBar(menuBar)  # Add the menuBar to the Frame

    def SetTitle(self):
        # MainWindow.SetTitle overrides wx.Frame.SetTitle, so we have to
        # call it using super:
        super(MainWindow, self).SetTitle('Editor %s'%self.filename)


    # Helper methods:

    def defaultFileDialogOptions(self):
        ''' Return a dictionary with file dialog options that can be
            used in both the save file dialog as well as in the open
            file dialog. '''
        return dict(message='Choose a file', defaultDir=self.dirname,
                    wildcard='*.*')

    def askUserForFilename(self, **dialogOptions):
        dialog = wx.FileDialog(self, **dialogOptions)
        if dialog.ShowModal() == wx.ID_OK:
            userProvidedFilename = True …
richieking 44 Master Poster

spot on ;)

richieking 44 Master Poster

Here you are as you wanted buddy
:)

import wx
import os.path


class MainWindow(wx.Frame):
    def __init__(self, filename='noname.txt'):
        super(MainWindow, self).__init__(None, size=(400,200))
        self.filename = filename
        self.dirname = '.'
        self.CreateInteriorWindowComponents()
        self.CreateExteriorWindowComponents()
        self.prin=4004
        
    def CreateInteriorWindowComponents(self):
        ''' Create "interior" window components. In this case it is just a
            simple multiline text control. '''
        self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE)

    def CreateExteriorWindowComponents(self):
        ''' Create "exterior" window components, such as menu and status
            bar. '''
        self.CreateMenu()
        self.CreateStatusBar()
        self.SetTitle()

    def CreateMenu(self):
        fileMenu = wx.Menu()
        for id, label, helpText, handler in \
            [(wx.ID_ABOUT, '&About', 'Information about this program',
                self.OnAbout),
             (wx.ID_OPEN, '&Open', 'Open a new file', self.OnOpen),
             (wx.ID_SAVE, '&Save', 'Save the current file', self.OnSave),
             (wx.ID_SAVEAS, 'Save &As', 'Save the file under a different name',
                self.OnSaveAs),
                
                (wx.ID_PRINT, '&Print', 'Print the current document',
                self.OnPrint),
             (None, None, None, None),
             (wx.ID_EXIT, 'E&xit', 'Terminate the program', self.OnExit)]:
            if id == None:
                fileMenu.AppendSeparator()
            else:
                item = fileMenu.Append(id, label, helpText)
                self.Bind(wx.EVT_MENU, handler, item)

        menuBar = wx.MenuBar()
        menuBar.Append(fileMenu, '&File') # Add the fileMenu to the MenuBar
        self.SetMenuBar(menuBar)  # Add the menuBar to the Frame

    def SetTitle(self):
        # MainWindow.SetTitle overrides wx.Frame.SetTitle, so we have to
        # call it using super:
        super(MainWindow, self).SetTitle('Editor %s'%self.filename)


    # Helper methods:

    def defaultFileDialogOptions(self):
        ''' Return a dictionary with file dialog options that can be
            used in both the save file dialog as well as in the open
            file dialog. '''
        return dict(message='Choose a file', defaultDir=self.dirname,
                    wildcard='*.*')

    def askUserForFilename(self, **dialogOptions):
        dialog = wx.FileDialog(self, **dialogOptions)
        if dialog.ShowModal() == wx.ID_OK:
            userProvidedFilename = True
            self.filename = dialog.GetFilename()
            self.dirname = dialog.GetDirectory()
            self.SetTitle() # Update the window title with the …
richieking 44 Master Poster

This is even a basic one. Python can do almost everything you want to do.
:)

richieking 44 Master Poster

Yea tonyjv's stuff will ease your burden :).

richieking 44 Master Poster

But if when I place import smtplib the error says 'DLL load failed, the specified module cannot be found.

That means you have to get that module. Very simple error.
Also as i tried to tell you. importing... You cant not implement a method from import in your code if you have not imported its module first. Therefore smtplib,os and re modules are meant to be on the top.
Just to be on the safe side.

Learn how to import before implement. Good rule of the thumb.
:)

richieking 44 Master Poster

Put all your import on top of the page.
that is line 60 through 69, followed by line 59.
That should help solve your problem.
:)

richieking 44 Master Poster

mmmmmmmmmmmmm not bad. I jus dont see any real life need for this algo. besides There should be a better way than this.
:)

richieking 44 Master Poster

well but your code does not show where you defined 'MIMEMultipart()' but its implemented on line 30.

richieking 44 Master Poster

use doubble slashes

c:\\My Document\\"
richieking 44 Master Poster

give the link to the site for the module