[Tkinter-discuss] Issue with scrolling in a Text() widget on a mac

Alexnb alexnbryan at gmail.com
Sat Jul 19 18:58:18 CEST 2008




Kevin Walzer-5 wrote:
> 
> Alexnb wrote:
> 
>> Yes sorry. I do actually have that, I just forgot to put it in because it
>> was below some comments. Everything works perfect on windows, but not on
>> mac, which is the weird part. I think it is just maybe an issue in
>> Tkinter
>> with mac. 
>>
> It might be helpful to put together a small code sample that can help me 
> to replicate the issue better. I don't see any problems with scrolling a 
> Tkinter text widget on the Mac. IDLE, for instance, works fine: I can 
> scroll with the mousewheel, by dragging the scrollbar, and by clicking 
> the arrow in the scrollbar's trough.
> 
> My setup is OS X 10.5.4, Python 2.5.2, Tk 8.5.3.
> 
> -- 
> Kevin Walzer
> Code by Kevin
> http://www.codebykevin.com
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
> 
> 


Okay, here we go. Try this out, let me know how it works. It has the same
issue for me.


from Tkinter import *

class TestText:
    def __init__(self, parent):
        self.parent = parent
        
        self.baseFrame = Frame(self.parent)
        self.baseFrame.pack(fill=BOTH, expand=YES)
                
        self.scrollbar = Scrollbar(self.baseFrame)
        self.scrollbar.pack(side=RIGHT, fill=Y, pady=15)

        self.text = Text(self.baseFrame,
                         yscrollcommand=self.scrollbar.set)
        self.text.pack(side=LEFT, fill=BOTH, expand=YES)
        
        self.scrollbar.config(command=self.text.yview)
        
        self.n = 0
        for x in range(40):
            self.text.insert(END, str(self.n) + "\n")
            self.n = self.n+1
        
root = Tk()
tt = TestText(root)
root.mainloop()
-- 
View this message in context: http://www.nabble.com/Issue-with-scrolling-in-a-Text%28%29-widget-on-a-mac-tp18541172p18546591.html
Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.



More information about the Tkinter-discuss mailing list