Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

Anyone familiar with Tkinter?

I get mostly everything about Tkinter except scrollable windows which I can't understand how to implement to be actually functionable. Anyone knows the best way to implement it when the GUI goes outside of the window and you can be able to scroll to see other GUI's?

2 Answers

Kenneth Love
STAFF
Kenneth Love
Treehouse Guest Teacher

Can you share the code you have? I don't have much experience with Tkinter but I'm happy to poke at it a bit.

I have a frame but I want it to be scrollable. What I am coding is for people that use the software Poser and it helps make some task easy such as importing morphs for content. But depending on how many they would be importing it could make the window so long that it would go outside of the bounds of the screen. Which is not good.

if(current_Path==None or current_Path==""):
        tkMessageBox.showinfo("Location Error","A location hasn't been selected!")
else:
        if(ConfirmOBJSExisit()):
            cancelProcess(activeWin)  
            loadMor=Tk.Tk()
            loadMor.title("Batch Morph List")
            loadMor.geometry('700x600')
            loadMor.title("Morph List")
            loadMor.resizable(width=False,height=False)            


            frame=Tk.Frame(loadMor,width=700,height=600)


            #Label
            pathLabel=Tk.Label(frame,text=current_Path)
            pathLabel.grid(row=0,column=0,padx=10,pady=10,columnspan=2)
            sectionLabel1=Tk.Label(frame,text="Settings")
            sectionLabel1.grid(row=1,column=0,pady=10)
            sectionLabel2=Tk.Label(frame,text="New Morph Name")
            sectionLabel2.grid(row=1,column=1)
            sectionLabel3=Tk.Label(frame,text="Min. Value")
            sectionLabel3.grid(row=1,column=4)
            sectionLabel4=Tk.Label(frame,text="Max. Value")
            sectionLabel4.grid(row=1,column=5)
            current_Row=2
            current_Col=0
            #this will show available objs for morphs
            itemplace=0

            for morph in objNames: 


                MorphName=morph.strip('.obj')
                Tk.Label(loadMor,text=MorphName).grid(row=current_Row,column=current_Col,sticky=Tk.W,padx=10)
                ##Tk.Entry(textBox,width=1)
                entryMorphNames.append(Tk.Entry(frame,width=25))
                entryMorphNames[itemplace].insert(0,MorphName)
                entryMorphNames[itemplace].grid(row=current_Row,column=current_Col+1,sticky=Tk.W)

                PBMCheckBox.append(NewButton(frame,"PBM",1))
                PBMCheckBox[itemplace].set_pos(current_Row,current_Col+2)


                FBMCheckBox.append(NewButton(frame,"FBM",0))
                FBMCheckBox[itemplace].set_pos(current_Row,current_Col+3)


                entryMorphMin.append(Tk.Entry(frame, width=10))
                entryMorphMin[itemplace].insert(0,"-1")
                entryMorphMin[itemplace].grid(row=current_Row, column=current_Col+4)

                entryMorphMax.append(Tk.Entry(frame,width=10))
                entryMorphMax[itemplace].insert(0,"1")
                entryMorphMax[itemplace].grid(row=current_Row,column=current_Col+5,padx=10)

                current_Row=current_Row+1
                itemplace+=1

            applyMorph=Tk.Button(frame,text="Apply Morph(s)",command=lambda:applymorphs(loadMor,FBMCheckBox,PBMCheckBox))
            applyMorph.grid(row=current_Row+1, column=2,pady=20)
            morphCancel=Tk.Button(frame,text="Cancel Process",command=lambda:cancelProcess(loadMor))
            morphCancel.grid(row=current_Row+1,column=3)


            frame.pack()
            loadMor.mainloop()