2016-07-19 39 views
1

このコードを使ってテキストウィンドウを作成していますが、スクロールバーを非表示にする方法がわかりませんでした。 wxpythonがサポートしていない答えがありました。感謝! ありがとう!wxPythonで縦横のスクロールバーを非表示にする方法は?

注:スクロール
感謝:)

import wx 
import wx.lib.dialogs 
import wx.stc as stc 



faces = {'times':'Times New Roman','helv':"Arial","size":18} 

class MainWindow(wx.Frame): 
    def __init__(self,parent,title): 
     self.filepath ='' 
     self.leftMarginWidth = 25 
     wx.Frame.__init__(self,parent,title=title,size=(1350,720)) 

     self.control=stc.StyledTextCtrl(self,style=wx.TE_MULTILINE | wx.TE_WORDWRAP|wx.TE_NO_VSCROLL) 
     self.control.CmdKeyAssign(ord("+"),stc.STC_SCMOD_CTRL,stc.STC_CMD_ZOOMIN) #Ctrl + + to zoom in 
     self.control.CmdKeyAssign(ord("-"),stc.STC_SCMOD_CTRL,stc.STC_CMD_ZOOMOUT) #Ctrl + - to zoom out 
     self.control.SetViewWhiteSpace(False) 
     self.control.SetMargins(5,0) 
     self.control.SetMarginType(1,stc.STC_MARGIN_NUMBER) 
     self.control.SetMarginWidth(1,self.leftMarginWidth) 
     self.control.Bind(wx.EVT_CHAR,self.OnCharEvent) 

     #don't forget the statusBar 
     #file men if you want it 
     self.Show() 

    def OnSave(self,e): 
     try: 
      f= open(self.filepath,"w") 
      f.write(self.control.GetText()) 
      f.close() 
     except: 
      self.OnSaveAs(self) 
    def OnSaveAs(self,e): 
     try: 
      dlg=wx.FileDialog(self,'save file as',self.filepath,"untitled","*.*",wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT) 
      print dlg 
      if (dlg.ShowModal()== wx.ID_OK): 
       self.filepath = dlg.GetPath() 
       f=open(self.filepath,"w") 
       f.write(self.control.GetText()) 
       f.close() 
      dlg.Destroy() 
     except: 
      pass 
    def OnOpen(self,e): 
     dlg=wx.FileDialog(self,"Choose a file",self.filepath,'',"*.*",wx.FD_OPEN) 
     if(dlg.ShowModal() == wx.ID_OK): 
      self.filepath = dlg.GetPath() 
      f=open(self.filepath,"r") 
      self.control.SetText(f.read()) 
      f.close() 
     dlg.Destroy() 

    def OnCharEvent(self,e): 
     keycode=e.GetKeyCode() 
     print keycode 
     if (keycode == 15): 
      self.OnOpen(self) 
     elif keycode == 19: 
      self.OnSave(self) 
     else: 
      e.Skip() 

app=wx.App() 
frame = MainWindow(None,"my text Editor") 

app.MainLoop() 

image

答えて

関連する問題