E
E
Evgeny Ilin2011-12-21 14:06:30
Python
Evgeny Ilin, 2011-12-21 14:06:30

tkinter: how to get a string from any Text widget in which the Menu widget is called (cursor is on, text is selected)

Actually, there is an example , when a key is bound to an Entry instance and the line is obtained as follows
event.widget.get()
:
a link to pastebin , a link to dumpz with more kosher highlighting and fonts.
As far as I understand, when adding a command to the Menu widget, a bind is not possible.
In this code, when using the copy function from the menu, an error is generated.
AttributeError: 'Application' object has no attribute 'widget'
In all the examples that I dug up, including in the text editor example, the Text widget is one per frame (or within the class) and is accessed through self.
Occasionally a cowardly thought runs through that this functionality is not possible within Tkinter.
I hope this is just my ignorance.
Which way to look?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question