问题描述
.py:
cmd.NewCmdRoot()
.kv
class file(Popup):
load = Objectproperty()
class file1(Screen):
file_path = StringProperty(None)
the_popup = ObjectProperty(None)
def select_to(self):
self.the_popup= file(load=self.load)
self.the_popup.open()
def load(self,selection):
pdf= FPDF()
self.file_path = str(selection[0])
self.the_popup.dismiss()
imgs=[]
imgs.append(self.file_path)
for image in imgs:
width,height= 0,0
pdf.add_page()
pdf.image(image,width,height)
pdf.save('name.pdf')
我有问题如何在一个 pdf 中选择多个图像?任何人都可以在此代码中提供帮助吗?
解决方法
def load(self,selection):
pdf= FPDF()
self.file_path = str(selection[0])
self.the_popup.dismiss()
imgs=[]
imgs.append(self.file_path)
for image in selection:
width,height= 0,0
pdf.add_page()
pdf.image(image,width,height)
pdf.save('name.pdf')