本文整理匯總了Python中photo.Photo.printing方法的典型用法代碼示例。如果您正苦於以下問題:Python Photo.printing方法的具體用法?Python Photo.printing怎麽用?Python Photo.printing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類photo.Photo
的用法示例。
在下文中一共展示了Photo.printing方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from photo import Photo [as 別名]
# 或者: from photo.Photo import printing [as 別名]
class PyPhotoBooth:
def __init__(self):
self.photo = Photo()
self.photo_live = True
self.global_count = 0
self.MainWindow = uic.loadUi('main.ui')
self.webcam = cv.CreateCameraCapture(-1)
self.timer = QtCore.QTimer(self.MainWindow)
self.MainWindow.connect(
self.timer, QtCore.SIGNAL('timeout()'), self.show_frame
)
self.MainWindow.connect(
self.MainWindow.pushButton, QtCore.SIGNAL("clicked()"),
self.take_photo
)
if AUTO_PRINT:
self.MainWindow.pushButton_2.hide()
else:
self.MainWindow.connect(
self.MainWindow.pushButton_2, QtCore.SIGNAL("clicked()"),
self.print_photo_button
)
if PATCH_BACKGROUND_IMG is not None:
palette = QtGui.QPalette()
palette.setBrush(
QtGui.QPalette.Background, QtGui.QBrush(
QtGui.QPixmap(PATCH_BACKGROUND_IMG)
)
)
self.MainWindow.setPalette(palette)
if PATCH_LOGO_IMG is not None:
self.MainWindow.lbllogo.setPixmap(
QtGui.QPixmap(PATCH_LOGO_IMG)
)
self.timer.start(1)
def take_photo(self):
self.photo.take(self)
def print_photo_button(self):
result, count = self.photo.printing(self.global_count)
if result:
self.MainWindow.lcdNumber.display(0)
self.MainWindow.lcdNumber.repaint()
self.MainWindow.pick_01.setText(' ')
self.MainWindow.pick_01.repaint()
self.MainWindow.pick_02.setText(' ')
self.MainWindow.pick_02.repaint()
self.MainWindow.pick_03.setText(' ')
self.MainWindow.pick_03.repaint()
self.global_count = count
def show_frame(self):
if self.photo_live:
ipl_image = cv.QueryFrame(self.webcam)
data = ipl_image.tostring()
image = QtGui.QImage(
data, ipl_image.width, ipl_image.height, ipl_image.channels
* ipl_image.width, QtGui.QImage.Format_RGB888)
pixmap = QtGui.QPixmap()
pixmap.convertFromImage(image.rgbSwapped())
self.MainWindow.lblWebcam.setPixmap(pixmap)