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.
 
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
 
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>')
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top