<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Sep 29, 2008 at 5:10 PM,  <span dir="ltr"><<a href="mailto:dudeja.rajat@gmail.com">dudeja.rajat@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr"><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">On Sun, Sep 28, 2008 at 4:51 PM,  <span dir="ltr"><<a href="mailto:dudeja.rajat@gmail.com" target="_blank">dudeja.rajat@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr"><br clear="all">Hi,<br><br><br>Im using a tkinter scrollbars for horinzontal and vertical scrolling. Well the problem is I'm unable to scroll if I click on the arrows buttons of scrollbars ( with both types of scrollbars)<br>


<br><br>Please suggest if I m missing some configuration.<br><br><br>My code is as below:<br><br><font size="1"><span style="font-family: courier new,monospace;">self.hsb = Scrollbar(appGuiFrame, orient = HORIZONTAL)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">self.hsb.grid(row = 2,column = 0, sticky = E+W)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">#vertical scroll bar</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">self.vsb = Scrollbar(appGuiFrame)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">self.vsb.grid(row = 1,column = 2, sticky = N+S)</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">  </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">self.txtLogger = Text(appGuiFrame, \</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">                         height = 20,\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                         width = 100, \</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">                         state = DISABLED, \</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                         xscrollcommand = self.hsb.set, \</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">                         yscrollcommand = self.vsb.set, \</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                         wrap = NONE, \</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;">                         font = ("courier",12))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> self.hsb.config(command = self.txtLogger.xview())</span><br style="font-family: courier new,monospace;">


<span style="font-family: courier new,monospace;"> self.vsb.config(command = self.txtLogger.yview())</span></font><br><br><br>Please help.<br><br><br>Thanks and regards,<br>Rajat<br>
</div>
</blockquote></div><br><br clear="all"></div></div>Hi folks,<br><br>Any help on the above problem.<br><br>Regards,<br>Rajat<br>
</div>
</blockquote></div><br>Hi,<br><br>The problem got solved. After finding for such a long time I got a snippet at google and used the same in my code. It solved the problem.<br>Here is the complete code now:<br><br><font size="1"><span style="font-family: courier new,monospace;">class cLogToGUI:        </span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def __init__(self, logObj, appGUI):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.__logger = logObj</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.__logger.debug("Inside cLogToGUI::__init__")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        appGuiFrame = appGUI.frame4<br>
<br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">        #hor. scroll bar</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.hsb = Scrollbar(appGuiFrame, orient = HORIZONTAL)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.hsb.grid(row = 2,column = 0, sticky = E+W)<br><br style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">        #vertical scroll bar</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.vsb = Scrollbar(appGuiFrame)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.vsb.grid(row = 1,column = 2, sticky = N+S)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.txtLogger = Text(appGuiFrame, \</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                         height = 20,\</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                         width = 100, \</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                         state = DISABLED, \</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                         xscrollcommand = self.hsb.set, \</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                         yscrollcommand = self.vsb.set, \</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">                         wrap = NONE, \</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                         font = ("courier",12))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        #self.hsb.config(command = self.txtLogger.xview())</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        #self.vsb.config(command = self.txtLogger.yview())</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.hsb.config(command = self.__hsbScrollHandler)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.vsb.config(command = self.__vsbScrollHandler)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.txtLogger.bind("<<updateDisplay>>", self.outputText)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.txtLogger.grid(row = 1)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.txtLogger.tag_configure("error", foreground = "red")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.txtLogger.tag_configure("warning", foreground = "orange")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.txtLogger.tag_configure("success", foreground = "blue")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.__logger.debug("return from cLogToGUI::__init__")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def outputText(self, event):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.__logger.debug("Inside cLogToGUI::outputText()")</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.txtLogger.configure(state = NORMAL)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        string = TASymbols.strScrolledTextLine</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        tag = TASymbols.strScrolledTextLineTag</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        if not string:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            self.txtLogger.delete('1.0', END)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        else:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            self.txtLogger.insert(END, string, tag)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            #self.txtLogger.focus()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            self.txtLogger.see(END)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        self.txtLogger.configure(state = DISABLED)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        self.__logger.debug("return from cLogToGUI::outputText()")</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def __hsbScrollHandler(self, *L):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        op, howMany = L[0], L[1]</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        if op == "scroll":</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            units  =  L[2]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            self.txtLogger.xview_scroll ( howMany, units )</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        elif op == "moveto":</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            self.txtLogger.xview_moveto ( howMany )</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    def __vsbScrollHandler(self, *L):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        op, howMany = L[0], L[1]</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">        if op == "scroll":</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">            units  =  L[2]</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.txtLogger.yview_scroll ( howMany, units )</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">        elif op == "moveto":</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">            self.txtLogger.yview_moveto ( howMany )</span></font><br clear="all"><br>Thanks and regards,<br>Rajat<br>
</div>