С????????host
???????????? ???????[ 2016/8/25 14:27:18 ] ???????????ù??? ??????????
?????????????????У??????????host???л??????host??????????????????????
????????????????drivers/etc/hosts?????????ip????????????host??????????
????????????????host????л???????????????????host????????????????У?????鷳??
???????????????notepad++??notepad??hosts???????????????????ip?????????????????Ч??
?????????к???л?host??????????switchhosts?????????????????????????С???????????С????????????????????????host???????????????????
????????????????
????#coding:utf-8
????import wx
????import os
????class Frame(wx.Frame):
????def __init__(self):#????????????????
????wx.Frame.__init__(self??None??-1??'SwithHosts Example'??size=(1000??600))
????panel=wx.Panel(self??-1)
????ReadButton = wx.Button(panel?? label = u'??host'??pos = (225??5)??size = (80??25))
????ReadButton.Bind(wx.EVT_BUTTON?? self.Read)#??button??????
????saveButton = wx.Button(panel?? label = u'????host'??pos = (315??5)??size = (80??25))
????saveButton.Bind(wx.EVT_BUTTON??self.Save)#??button??????
????self.filename = 'C:WindowsSystem32driversetchosts'#host???·??
????self.contents = wx.TextCtrl(panel?? pos = (5??35)??size = (500??250)?? style = wx.TE_MULTILINE)
????hbox=wx.BoxSizer()
????hbox.Add(ReadButton??proportion=0??flag=wx.RIGHT|wx.HORIZONTAL)
????hbox.Add(saveButton??proportion=0??flag=wx.RIGHT|wx.HORIZONTAL)
????hbox.Add(self.contents??proportion=1??flag=wx.EXPAND|wx.ALL)
????panel.SetSizer(hbox)
????def Read(self??event):#???host???????????????
????file = open(self.filename)
????all_the_text=file.read()
????self.contents.SetValue(all_the_text)
????def Save(self??event):#????????е??????????д??host??
????value=self.contents.GetValue()
????file = open(self.filename??'w')
????file.write(value)
????file.close()
????if __name__ == "__main__":
????app=wx.PySimpleApp()
????frame=Frame()
????frame.Show()
????app.MainLoop()
????????????Ч??
????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11