Copy paste in entry widget


M

Michael Onfrek

Hi,
is copy, paste, cut of selection possible in entry widget? Docs say
selection must be copied by default, in my programm it doesn't work.
Regards, M.O.
 
Ad

Advertisements

S

Skip Montanaro

Michael> is copy, paste, cut of selection possible in entry widget? Docs
Michael> say selection must be copied by default, in my programm it
Michael> doesn't work.

What platform? What GUI toolkit?
 
V

VK

Skip said:
Michael> is copy, paste, cut of selection possible in entry widget? Docs
Michael> say selection must be copied by default, in my programm it
Michael> doesn't work.

What platform? What GUI toolkit?

Linux, Windows. TkInter, Pmw.
I've already implemented this with code under my message, but "cut"
copies entrytext, without deleting selection. Any ideas

def copy(self):
global copied
if self.entry.selection_present():
self.entry.clipboard_clear()
copied = self.entry.selection_get()
self.entry.bell()
def paste(self):
self.entry.insert(END, copied)
def cut(self):
global copied
self.entry.clipboard_clear()
if self.entry.selection_present():
copied = self.entry.selection_get()
self.entry.selection_clear()
self.entry.bell
 
Ad

Advertisements

V

VK

Michael said:
Hi,
is copy, paste, cut of selection possible in entry widget? Docs say
selection must be copied by default, in my programm it doesn't work.
Regards, M.O.
Hear it is

def paste(self):
self.entry.event_generate('<Control-v>')
def cut(self):
self.entry.event_generate('<Control-x>')
def copy(self):
self.entry.event_generate('<Control-c>')
 

Top