为什么没有显示我的按钮与图像。它只显示图像有什么错误吗?

时间:2020-04-25 17:54:33

标签: python tkinter

class BlogViewSet(viewsets.ModelViewSet):
    permission_classes = [
        permissions.IsAuthenticatedOrReadOnly
    ]
    serializer_class = BlogSerializer

    def get_queryset(self):
        return Blog.objects.all()

1 个答案:

答案 0 :(得分:0)

您只需使用全局变量。 1)删除lambda,然后输入函数名称 2)此外,您可以添加其他if / else arg。

image_list = [img1, img2, img3, img4, img4, img5, img6, img7, img8, img9, img10, 
              img11, img12, img13]
img_index = 0


def forword():
    global img_index
    img_index += 1          # THis will help to move img_index by 1

    label = Label(root, image=image_list[img_index])     # with  'image_list[img_index]'  you will get img. name on that index
    label.grid()

def backward():
    global img_index
    img_index -= 1

    label = Label(root, image=image_list[img_index])
    label.grid()
相关问题