Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
Python-Roadshow
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
workshops
Python-Roadshow
Commits
feaa3c2a
Commit
feaa3c2a
authored
Jan 19, 2018
by
Kriengsak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add save image for test
parent
8d90621e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
20 additions
and
11 deletions
+20
-11
1.bmp
sessions/session-3/Image/1.bmp
+0
-0
1.bmp
sessions/session-3/Image/1/1.bmp
+0
-0
2.bmp
sessions/session-3/Image/1/2.bmp
+0
-0
3.bmp
sessions/session-3/Image/1/3.bmp
+0
-0
4.bmp
sessions/session-3/Image/1/4.bmp
+0
-0
5.bmp
sessions/session-3/Image/1/5.bmp
+0
-0
1.bmp
sessions/session-3/Image/2/1.bmp
+0
-0
ubuwidgets.py
sessions/session-3/ubuwidgets.py
+18
-6
window.py
sessions/session-3/window.py
+2
-5
No files found.
sessions/session-3/Image/1.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/Image/1/1.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/Image/1/2.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/Image/1/3.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/Image/1/4.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/Image/1/5.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/Image/2/1.bmp
deleted
100644 → 0
View file @
8d90621e
246 Bytes
sessions/session-3/ubuwidgets.py
View file @
feaa3c2a
...
@@ -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
)
...
@@ -117,4 +128,4 @@ class Board(QWidget):
...
@@ -117,4 +128,4 @@ class Board(QWidget):
newImage
.
fill
(
qRgb
(
255
,
255
,
255
))
newImage
.
fill
(
qRgb
(
255
,
255
,
255
))
painter
=
QPainter
(
newImage
)
painter
=
QPainter
(
newImage
)
painter
.
drawImage
(
QPoint
(
0
,
0
),
image
)
painter
.
drawImage
(
QPoint
(
0
,
0
),
image
)
self
.
image
=
newImage
self
.
image
=
newImage
\ No newline at end of file
sessions/session-3/window.py
View file @
feaa3c2a
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
):
...
@@ -45,4 +41,4 @@ if __name__ == '__main__':
...
@@ -45,4 +41,4 @@ if __name__ == '__main__':
app
=
QApplication
(
sys
.
argv
)
app
=
QApplication
(
sys
.
argv
)
window
=
MainWindow
()
window
=
MainWindow
()
window
.
show
()
window
.
show
()
sys
.
exit
(
app
.
exec_
())
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment