Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
O
objQRcode
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
Thorfin89
objQRcode
Commits
28953c07
Commit
28953c07
authored
Dec 25, 2023
by
Thorfin89
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First commit
parents
Pipeline
#53
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
122 additions
and
0 deletions
+122
-0
main.py
main.py
+122
-0
No files found.
main.py
0 → 100644
View file @
28953c07
from
tkinter
import
*
import
qrcode
from
qrcode.constants
import
ERROR_CORRECT_M
from
PIL
import
Image
# ===== FONCTIONS =====
def
new_file
():
pass
def
sel
():
selection
=
str
(
value
.
get
())
label
.
config
(
text
=
selection
)
def
create_code
():
if
texte
.
get
()
!=
""
:
global
logo
qr
=
qrcode
.
QRCode
(
version
=
3
,
error_correction
=
ERROR_CORRECT_M
,
box_size
=
5
,
border
=
2
)
qr
.
add_data
(
texte
.
get
())
qr
.
make
(
fit
=
'True'
)
img
=
qr
.
make_image
(
fill_color
=
"blue"
,
back_color
=
"white"
)
img
.
save
(
'qrcode.png'
)
logo
=
PhotoImage
(
file
=
"qrcode.png"
)
logovisu
.
config
(
image
=
logo
)
img
=
Image
.
open
(
"qrcode.png"
)
size
=
img
.
size
print
(
size
)
logovisu
.
place
(
x
=
200
-
size
[
0
]
//
2
,
y
=
200
-
size
[
1
]
//
2
)
else
:
print
(
"Pas de texte à coder"
)
# création de la fenêtre principale
root
=
Tk
()
root
.
geometry
(
'800x480+100+100'
)
root
.
title
(
"ObjQRCode"
)
root
.
config
(
bg
=
"lightgray"
)
ESP
=
25
# Création de la barre des menus
menuBar
=
Menu
(
root
)
# Création du menu principal 'Fichier'
menuFichier
=
Menu
(
menuBar
,
tearoff
=
0
)
menuBar
.
add_cascade
(
label
=
"Fichier"
,
menu
=
menuFichier
)
# Création des sous menus :
menuFichier
.
add_command
(
label
=
"Nouveau"
,
command
=
new_file
)
menuFichier
.
add_command
(
label
=
"Ouvrir"
)
menuFichier
.
add_command
(
label
=
"Enregistrer"
)
menuFichier
.
add_command
(
label
=
"Enregistrer sous"
)
menuFichier
.
add_command
(
label
=
"Quitter"
,
command
=
quit
)
# Création du menu principal 'Fichier'
menuAide
=
Menu
(
menuBar
,
tearoff
=
0
)
menuBar
.
add_cascade
(
label
=
"Aide"
,
menu
=
menuAide
)
# Création des sous menus :
menuAide
.
add_command
(
label
=
"Info"
)
# Configuration de la barre des menus
root
.
config
(
menu
=
menuBar
)
# ===== FRAMES =====
conf
=
Frame
(
root
,
bg
=
"lightgray"
)
conf
.
place
(
x
=
0
,
y
=
0
,
width
=
400
,
height
=
400
)
visu
=
Frame
(
root
,
bg
=
"gray"
)
visu
.
place
(
x
=
401
,
y
=
0
,
width
=
400
,
height
=
400
)
saisie
=
Frame
(
root
,
bg
=
"lightgray"
)
saisie
.
place
(
x
=
0
,
y
=
401
,
width
=
800
,
height
=
240
)
# ===== WIDGETS =====
# boutons radios de choix
value
=
StringVar
()
value
.
set
(
"OUI"
)
bouton1
=
Radiobutton
(
conf
,
text
=
"Oui"
,
variable
=
value
,
value
=
"OUI"
,
command
=
sel
)
bouton2
=
Radiobutton
(
conf
,
text
=
"Non"
,
variable
=
value
,
value
=
"NON"
,
command
=
sel
)
bouton3
=
Radiobutton
(
conf
,
text
=
"Peut-être"
,
variable
=
value
,
value
=
"JE NE SAIS PAS"
,
command
=
sel
)
bouton1
.
config
(
bg
=
"lightgray"
)
bouton2
.
config
(
bg
=
"lightgray"
)
bouton3
.
config
(
bg
=
"lightgray"
)
bouton1
.
place
(
x
=
10
,
y
=
20
+
ESP
)
bouton2
.
place
(
x
=
10
,
y
=
20
+
2
*
ESP
)
bouton3
.
place
(
x
=
10
,
y
=
20
+
3
*
ESP
)
# titre de la zone de choix
titre
=
Label
(
conf
,
text
=
"CHOIX :"
,
bg
=
"lightgray"
)
titre
.
place
(
x
=
10
,
y
=
20
)
# affichage du choix
label
=
Label
(
conf
,
text
=
"OUI"
,
width
=
20
,
height
=
2
,
borderwidth
=
1
,
relief
=
"solid"
)
label
.
config
(
bg
=
"lightgray"
)
label
.
place
(
x
=
10
,
y
=
10
+
5
*
ESP
)
# bouton de création du QRCode
create_Btn
=
Button
(
conf
,
text
=
"Créer le Code"
,
bg
=
"lightgreen"
,
command
=
create_code
)
create_Btn
.
place
(
x
=
280
,
y
=
360
,
width
=
100
,
height
=
40
)
# texte à coder
labelTexte
=
Label
(
saisie
,
text
=
'Texte à coder :'
,
bg
=
"lightgray"
)
labelTexte
.
place
(
x
=
10
,
y
=
10
)
texte
=
Entry
(
saisie
,
width
=
122
)
texte
.
place
(
x
=
30
,
y
=
40
)
# affichage du QRcode
logo
=
""
logovisu
=
Label
(
visu
)
logovisu
.
config
(
image
=
logo
)
logovisu
.
place
(
x
=
400
,
y
=
400
)
root
.
mainloop
()
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