wxpython question:

I am looking for a way to select just a line of text out of many lines of text by just clicking anywhere on the line of text, like what is shown in the attachment. Let's say I have a TextCtrl with lines of text. How would I go about selecting one line just by clicking anywhere on the line?

Or would I have to use a grid or something?

Recommended Answers

All 12 Replies

sample code??
Are you using TextCtrl or what?

Why don't you try using a wxListBox set with the style flag for allowing only a single item to be selected at once? It's a simple solution if you're using wxPython.

Oh, it now seems painfully obvious.

Why Painful? Yes thing aren't easy but possible!
You have to state clearly everything where have you failed or what you want to do but have no Idea where to start. From there it is simple to help you! Don't give up so easily!

wx.ListCtrl is the best choice in my Opinion,
as Shadwick i suggest using style flag to get thing done

Why Painful? Yes thing aren't easy but possible!
You have to state clearly everything where have you failed or what you want to do but have no Idea where to start. From there it is simple to help you! Don't give up so easily!

Um... evstevemd, I don't believe he's giving up. 'Painfully obvious' as in he couldn't believe he didn't think of it before. I know your English isn't perfect, but just to let you know what that expression is.

I meant give up in the forum and not Quit the programming deal
Anyway I don't know what he mean exactly unless he explains lol:

Oh! Ok, sorry about that misunderstanding haha.

No problem! Misunderstanding that ends with understanding is not.....bad haaah

Ya, I meant I should have thought of it before. Anyway, the lack of wxpython documentation is bugging me. I have the demo, and that helps a lot, but still, not everything is explained there.

Hey, if anybody knows, is there a way to move a menubar down from the very top of the frame? Like so I could have some elements above the menubar?

This new question you're asking should've been asked in a new thread. Regardless, as far as I know, the wx.MenuBar widget attaches to the top of the frame, and has no SetPosition() method. If there's any way to embed a frame within another frame, then it's feasible, but it might be easier to just write your own class similar to a MenuBar and implement that.

I would have started a new thread, but since this one was already created... and I just had a quick question about something that I wasn't even sure there was an answer for... I didn't want to create a new thread that might not get any answers.

But thanks for the answer you gave me. I'll see what I can do.

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.