I use ruby's TkText to display the text and use bind to right-click and move the mouse.
Is it possible to prohibit copying text using the mouse?
You can set state to disabled to prevent text editing, but you can copy text.
Please tell me how to prohibit copying text displayed on TkText.
ruby
Why don't you set TkText exportselection
to false
?
require'tk'
text=TkText.new('exportselection'=>false)
text.pack('fill'=>'both')
quitButton=TkButton.new(nil, 'text'=>'quit', 'command'=>proc {exit})
quitbutton.pack('fill'=>'both')
Tk.mainloop
However, exportselection
has been described as targeting X Window System selection, so it may not work as expected in environments with a window system other than X Window System.
© 2024 OneMinuteCode. All rights reserved.