Windows图片查看器不出现下一张和上一张按钮

Windows 照片查看

问题描述:在文件夹中查看所有图片,但是图片查看器不出现“下一张”和“上一张”的按钮;
解决方法:将图片文件夹拷贝到"此电脑"——图片(Pictures) 路径下,重启计算机,就可以了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个基本的 wxPython 实现点击上一张一张按钮查看文件夹中所有图片文件列表的例子: ```python import os import wx class MyFrame(wx.Frame): def __init__(self, parent, title): wx.Frame.__init__(self, parent, title=title, size=(800, 600)) self.panel = wx.Panel(self) self.image_list = [] self.current_index = 0 self.image_label = wx.StaticText(self.panel, label="No images found", pos=(350, 280)) self.prev_button = wx.Button(self.panel, label="Previous", pos=(280, 320)) self.Bind(wx.EVT_BUTTON, self.on_prev_button_click, self.prev_button) self.next_button = wx.Button(self.panel, label="Next", pos=(440, 320)) self.Bind(wx.EVT_BUTTON, self.on_next_button_click, self.next_button) def load_images(self, directory): for filename in os.listdir(directory): if filename.lower().endswith('.jpg') or filename.lower().endswith('.png'): image_path = os.path.join(directory, filename) self.image_list.append(image_path) if len(self.image_list) > 0: self.show_image(self.current_index) def show_image(self, index): image = wx.Image(self.image_list[index], wx.BITMAP_TYPE_ANY) self.image_label.SetLabel("") self.image_label.SetBitmap(wx.BitmapFromImage(image)) def on_prev_button_click(self, event): if self.current_index > 0: self.current_index -= 1 self.show_image(self.current_index) def on_next_button_click(self, event): if self.current_index < len(self.image_list) - 1: self.current_index += 1 self.show_image(self.current_index) app = wx.App() frame = MyFrame(None, "Image Viewer") frame.load_images("path_to_directory") frame.Show() app.MainLoop() ``` 这个例子创建了一个窗口,里面包含了一个标签和两个按钮,可以用来查看指定文件夹中的所有图片文件。当点击上一张或下一张按钮时,会显示前一张或后一张图片

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值