Skip to content Skip to sidebar Skip to footer

Cannot Use Geometry Manager Pack Inside . Which Already Has Slaves Managed By Grid

I want to use grid to show pdf but it's showing error that cannot use geometry manager pack inside . which already has slaves managed by grid. from tkinter import * from tkPDFViewe

Solution 1:

This is a bug of tkPDFViewer. Look into the code of tkPDFViewer:

class ShowPdf():
    ...
    def pdf_view(self,master,width=1200,height=600,pdf_location="",bar=True,load="after"):
        ...
        if bar==True and load=="after":
            self.display_msg = Label(textvariable=percentage_load) # this will create the label in root window instead of its frame
            self.display_msg.pack(pady=10) # this will raise exception if widgets in root window are using `grid()`
            ...

To skip the bug, pass bar=False or load="" when calling pdf_view(...):

v2 = v1.pdf_view(root,
                 pdf_location=r"C:\\Users\\mande\\Desktop\\Books\\Mystery\\Dead Until Dark.pdf",
                 bar=False) # set bar=False

Note that the above change will disable the progress bar.


Post a Comment for "Cannot Use Geometry Manager Pack Inside . Which Already Has Slaves Managed By Grid"