< wxPython GUI
wxPython vágólap
Másolás
def click_toclipboard_button(self, event):
self.dataObj = wx.TextDataObject()
self.dataObj.SetText(self.resultText.GetValue())
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(self.dataObj)
wx.TheClipboard.Close()
else:
wx.MessageBox("A vágólap nem nyitható meg!", "Hiba")
Beillesztés
def click_paste_button(self, event):
success = False
dataObj = wx.TextDataObject()
if wx.TheClipboard.Open():
success = wx.TheClipboard.GetData(dataObj)
wx.TheClipboard.Close()
if success:
self.resultText.SetValue(dataObj.GetText())
else:
wx.MessageBox('Nincs adat a vágólapon', 'Error')