Detailed Explanation of Main Program Module Design of Python Enterprise Code Generation System
- 2021-07-26 08:35:20
- OfStack
This paper describes the main program module of Python enterprise code generation system with examples. Share it for your reference, as follows:
1-point eye
The main program module includes three parts:
1 main program initialization
2 main program interface
3 Main program logic
The following are described separately
2 main program initialization
# The following 5 Each is an internal module
import os
import qrcode
import random
import time
import tkinter # Import tkinter
from pystrich.ean13 import EAN13Encoder # Bar code module
import tkinter.filedialog
import tkinter.messagebox
from string import digits
root = tkinter.Tk() # tkinter Module is python The standard graphical interface of. The purpose of this code is to create a root window
# Initialization data
number = "1234567890"
letter = "ABCDEFGHIJKLMNPQRSTUVWXYZ1234567890"
allis = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!@#$%^&*()_+"
i = 0
randstr = []
fourth = []
fifth = []
randfir = ""
randsec = ""
randthr = ""
str_one = ""
strone = ""
strtwo = ""
nextcard = ""
userput = ""
nres_letter = ""
3 main program interface
# Main menu of enterprise code management system
def mainmenu():
# os.system("clear")
print("""\033[1;35m
****************************************************************
Enterprise code generation system
****************************************************************
1. Generate 6 Bit digital anti-counterfeiting coding ( 213563 Type)
2. Generate 9 Digital anti-counterfeiting code of bit series products (879-335439 Type )
3. Generate 25 Bit mixed product serial number (B2R12-N7TE8-9IET2-FE35O-DW2K4 Type )
4. Generate anti-counterfeiting code with data analysis function (5A61M0583D2)
5. Intelligent batch generation of anti-counterfeiting codes with data analysis function
6. Subsequent supplementary generation of anti-counterfeiting code (5A61M0583D2)
7.EAN-13 Barcode batch generation
8.2 Batch output of dimension code
9. Corporate fan anti-counterfeiting code lottery
0. Exit the system
================================================================
Description: Select the menu by numeric keys
================================================================
\033[0m""")
4 Main program logic
# Control the user's selection of program functions through loop
while i < 9:
# Call in the main interface menu of the program
mainmenu()
# Keyboard input options that need to be operated
choice = input("\033[1;32m Please enter the menu option you want to operate :\33[0m")
if len(choice) != 0: # Enter if it is not empty
choice = input_validation(choice) # Verify that the input is numeric
if choice == 1:
scode1(str(choice)) # If you enter an integer greater than zero, call scode1() Function generates a registration code
# Select menu 2, Call scode2() Function generation 9 Digital anti-counterfeiting code of bit series products
if choice == 2:
scode2(choice)
# Select menu 3, Call scode3() Function generation 25 Bit mixed product serial number
if choice == 3:
scode3(choice)
# Select menu 4, Call scode4() Function to generate anti-counterfeiting code with data analysis function
if choice == 4:
scode4(choice)
# Select menu 5, Call scode5() Intelligent batch generation of anti-counterfeiting codes with data analysis function by function
if choice == 5:
scode5(choice)
# Select Menu 6 , Call scode6() Function to generate anti-counterfeiting code
if choice == 6:
scode6(choice)
# Select menu 7, Call scode7() Function to generate barcode in batch
if choice == 7:
scode7(choice)
# Select menu 8, Call scode8() Function batch generation 2 Dimension code
if choice == 8:
scode8(choice)
# Select menu 9, Call scode9() Function to generate enterprise fan lottery program
if choice == 9:
scode9(choice)
# Select menu 0, Exit the system
if choice == 0:
i = 0
print(" Exiting the system !!")
break
else:
print("\033[1;31;40m The input is illegal, please re-enter! ! \033[0m")
time.sleep(2)
5 Digital verification function
# Input digital verification to determine whether the input is in 0-9 Integer between
def input_validation(insel):
if str.isdigit(insel):
insel = int(insel)
return insel
else:
print("\033[1;31;40m The input is illegal, please re-enter! ! \033[0m")
return 0
6 Running
****************************************************************
Enterprise code generation system
****************************************************************
1. Generate 6-digit anti-counterfeiting code (213563 type)
2. Generate the digital anti-counterfeiting code of 9-digit series products (879-335439 type)
3. Generate a 25-digit mixed product serial number (type B2R12-N7TE8-9IET2-FE35O-DW2K4)
4. Generate anti-counterfeiting code with data analysis function (5A61M0583D2)
5. Intelligent batch generation of anti-counterfeiting codes with data analysis function
6. Subsequent addition generates anti-counterfeiting code (5A61M0583D2)
7. EAN-13 barcode batch generation
Batch output of 8.2-dimensional code
9. Corporate Fan Security Code Lucky Draw
0. Exit the system
================================================================
Description: Select the menu by numeric keys
================================================================Please enter the menu option you want to operate: 0
Exiting the system! !
For more readers interested in Python related contents, please check the topics of this site: Summary of Python Coding Operation Skills, Summary of Python Picture Operation Skills, Tutorial of Python Data Structure and Algorithm, Summary of Python Socket Programming Skills, Summary of Python Function Use Skills, Summary of Python String Operation Skills, Introduction and Advanced Classic Tutorial of Python and Summary of Python File and Directory Operation Skills
I hope this article is helpful to everyone's Python programming.