Problem with ButtonRelease-2 event in Text widgets

A

andrea

I have a dialog with a Pmw.ScrolledText widget were a user can paste a
text with button-2.

After pasting i want to know how many characters are pasted. But when
the '<ButtonRelease-2>' event occurs the text is not pasted, this
happens afterward.
With '<KeyRelease>' events it works fine (eg 'Shift'+'Insert'). Why?

Is there a possibility to get the pasted text at this moment?


TIA!


###
sample code:
###

import Pmw

class CText:
def show (self):
dlg = Pmw.Dialog()

self.textbox = Pmw.ScrolledText(dlg.interior())
self.textbox.pack()
self.textbox.component('text').bind('<KeyRelease>',
self.printLength)
self.textbox.component('text').bind('<ButtonRelease-2>',
self.printLength)

dlg.activate()

def printLength (self, event):
print len(self.textbox.get())


if( __name__ == '__main__' ):
textObj = CText()
textObj.show()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top