2006年12月26日 星期二 10:00
大家好,这个问题是我问的,我的问题现在解决了,我把源码发给大家,从网上看到这个例子,经过修改!
import wx
##########################################
f1=file(r'd:\tianyaamy\test1.txt') #
result=f1.read(500) #
print result #这里是点击按纽后COPY的数据源
t1_text = result #
f1.close() #
##########################################
###############################################################################and this is the botton with wxpython's frame
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title=r"获得检测结果请点击窗口的复制按纽",
size=(700,110))
p = wx.Panel(self)
self.t1 = wx.TextCtrl(p,-1,t1_text,
style=wx.TE_CENTER|wx.HSCROLL)
copy = wx.Button(p, 0, "点击复制检测结果标题")
# setup the layout with sizers
fgs = wx.FlexGridSizer(0, 1)
fgs.AddGrowableRow(0)
fgs.AddGrowableCol(0)
fgs.AddGrowableCol(0)
fgs.Add(self.t1, 0, wx.EXPAND)
fgs.Add(copy, 5, wx.EXPAND)
border = wx.BoxSizer()
border.Add(fgs, 1, wx.EXPAND|wx.ALL, 5)
p.SetSizer(border)
# Bind events
self.Bind(wx.EVT_BUTTON, self.OnDoCopy, copy)
def OnDoCopy(self, evt):
data = wx.TextDataObject()
data.SetText(self.t1.GetValue())
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(data)
wx.TheClipboard.Close()
else:
wx.MessageBox("Unable to open the clipboard", "Error")
app = wx.PySimpleApp()
frm = MyFrame()
frm.Show()
app.MainLoop()
> -----Original Message-----
> 发件人: "zhang peng" <finalmdj在gmail.com>
> 日期: Tue, 26 Dec 2006 09:25:55 +0800
> 收件人: python-chinese在lists.python.cn
> 主题: Re: [python-chinese]
大家好,请教一个问题,生成一个按纽问题和有关粘贴板的操作!
> pywin32应该有这个功能把
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
----------------------------------------------
欢迎使用广州市市民电子邮局 http://www.gzemail.cn
2006年12月26日 星期二 10:04
如果是使用wx,它的demo中有例子的。 -- I like python! UliPad <>: http://wiki.woodpecker.org.cn/moin/UliPad My Blog: http://www.donews.net/limodou
Zeuux © 2025
京ICP备05028076号