Hi. Iam making an app to write and append to an html document blog-type blocks. I have the GUI finished, but I need to fusion it with my script.

Look at this snippet of my script:

def link(href,target,linkName):
    partA = "<a href='"+href+"' target='"+target+"'>"+linkName+"</a>"
    print partA

Now, this is the GUI (textbox) that I want to implement with that function:

self.linkUrl = TextBox(Text='url', Location=Point(8,304), Size=Size(113, 20))
        self.linkUrl.BackColor = Color.FromArgb(255, 255, 255)
        self.linkUrl.Font = Font('Microsoft Sans Serif', 8.25)
        self.linkUrl.Cursor = Cursors.Default

And its triggering button...

self.addLink = Button(Text='Add Link', Location=Point(7,328), Size=Size(288, 26))
        self.addLink.Font = Font('Microsoft Sans Serif', 8.25)
        self.addLink.Cursor = Cursors.Default

Now, I want to do that when the button is clicked this happens:

link([what is in the textbox],x,y)

Thats all i need.

Recommended Answers

All 4 Replies

I'm confused. Do you need to figure out how to get the text out of the textbox?

Also, what GUI toolkit are you using?


What I need is to get the content of the textbox with the click of the button.
I dont know what do you mean with the palette. All I know is that iam using FarPy GUI Editor

Alright, I've Googled for documentation on FarPy and come up empty.

If you take any object and pass it to dir, it will give you a readout of the available methods and properties of that object. Try inserting

print dir(self.linkUrl) into your code and look for a method that looks like "getText" or something similar.


Well, I read something about wxPython and I guess you can do it by
(for a button)
self.buttonName.Bind(wx.EVT_BUTTON, self.buttonNameClick)

Where buttonName is the button's name, and buttonNameClick is a function that is triggered when the button is clicked.

Sorry for not specifying that I was exporting to wxPython. Perhaps that would've helped. 8P

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.