i have a web browser made in python with menu. in one menu i have cut copy paste but no functionality and i need to make them work. i need an example of class oncopy.(event menu)
Open file i manage to work like this .takes file and print on screen the link to that file but how can make open dialog to open a file at least one type of file?
if filepath
is the absolute pathname of the file you got from the opendialog, try:
import os
os.startfile(filepath)
This will open your file with its corresponding windows application to which its extension is associated (like clicking twice in the file icon)
To copy a selected text in the HTML window, if you used:
import wx.lib.iewin as iewin
then in your Frame or Panel subclass you create your instance of the browser object in the __init__()
method with:
self.ie = iewin.IEHtmlWindow(self, -1, style =wx.NO_FULL_REPAINT_ON_RESIZE)
and bind the copy button onclick event with an 'on_copy' method.
Finally, you define the on_copy(self, event) method that should be triggered when you click the 'copy' button:
def on_copy(self, event):
self.selection = self.ie.GetStringSelection(asHTML=False)