how to hide the Vertical and horizontal Scrollbars with wxPython ? -
am using code create text window didn't figure out how hide scrollbars saw answers wxpython doesn't support , ideas ?? thanks!
note:hiding scrollbar not disabling scrolling
:)
import wx import wx.lib.dialogs import wx.stc 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 + + zoom in self.control.cmdkeyassign(ord("-"),stc.stc_scmod_ctrl,stc.stc_cmd_zoomout) #ctrl + - 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 statusbar #file men if want 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 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()
the styledtextctrl
class has setusehorizontalscrollbar
, setuseverticalscrollbar
methods.
Comments
Post a Comment