Commit feaa3c2a authored by Kriengsak's avatar Kriengsak

add save image for test

parent 8d90621e
...@@ -62,15 +62,26 @@ class Board(QWidget): ...@@ -62,15 +62,26 @@ class Board(QWidget):
cnt = 0 cnt = 0
maxf = 0 maxf = 0
for file in os.listdir(label): for file in os.listdir(label):
if file.endswith('.bmp'): if file.endswith('.png'):
cnt += 1 cnt += 1
tmpN = int(file[:-4:]) tmpN = int(file[:-4:])
maxf = max(maxf,tmpN) maxf = max(maxf,tmpN)
visibleImage.save('tmp.bmp') visibleImage.save('tmp.png')
pixmap = QPixmap('tmp.bmp').scaled(8,8) pixmap = QPixmap('tmp.png').scaled(16,16)
pixmap.save(label+'/'+str(max(cnt,maxf)+1)+'.bmp') pixmap.save(label+'/'+str(max(cnt,maxf)+1)+'.png')
QFile.remove('tmp.bmp') QFile.remove('tmp.png')
def saveImageTest(self):
import os
visibleImage = self.image
self.resizeImage(visibleImage,self.size())
if QDir('Test').exists() == False:
QDir().mkdir('Test')
visibleImage.save('tmp.png')
pixmap = QPixmap('tmp.png').scaled(16,16)
pixmap.save('Test/temp.png')
QFile.remove('tmp.png')
def paintEvent(self, event): def paintEvent(self, event):
painter = QPainter(self) painter = QPainter(self)
......
from PyQt5.QtCore import Qt from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QAction, QApplication, QWidget,QGridLayout) from PyQt5.QtWidgets import (QAction, QApplication, QWidget,QGridLayout)
#from board import Board
#from clearButton import ClearButton
#from trainWidget import TrainWidget
#from testWidget import TestWidget
from ubuwidgets import (Button, ComboWidget, Board) from ubuwidgets import (Button, ComboWidget, Board)
class MainWindow(QWidget): class MainWindow(QWidget):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment