For example I clicked on the first step after data preparation, the program automatically query SQL, the background will show a query to the data information, the information needs to be output to the GUI text box, according to the second step in the other, the third step and so on, because there will be some print () statements in the program to print, also need real-time display in the text box,
#! The/usr/bin/env python
# - * - coding: utf-8 - * -
"" "
"" "
The from __future__ import print_function
The from tkinter import *
The import threading
The from func import wt_process as wp
The from func import cx_process as cp
The from func import prepare_date as pd
The from func import creat_init as ci
The from tkinter import messagebox
From the tools import globVal
The import tkinter as tk
The import ctypes, sys
The import of logging
The from logging import handlers
COMM_DICT DB2_DICT, BK_DB2_DICT DRTP_DICT, SPX_DICT=globVal. Get_val ()
Def init_threading () :
# packaged function to the thread
If (v1. The get ()==1) :
Messagebox. Showinfo (title='did not choose to DB2, message=' you haven't choose master library or library, please choose!!! ')
The else:
Db2_info=ALL_DB2 [v1. The get ()]
Db2_ip=db2_info [2]
Db2_port=db2_info [4]
Gui_uid=e1. The get ()
Gui_pass=e2. The get ()
T=threading. Thread (target=ci creat_init, args=(gui_uid gui_pass, db2_ip, db2_port))
T.s etDaemon (True)
T.s tart ()
Def data_threading () :
# packaged function to the thread
If (v1. The get ()==1) :
Messagebox. Showinfo (title='did not choose to DB2, message=' you haven't choose master library or library, please choose!!! ')
The else:
Db2_info=ALL_DB2 [v1. The get ()]
Db2_ip=db2_info [2]
Db2_port=db2_info [4]
Gui_uid=e1. The get ()
Gui_pass=e2. The get ()
T=threading. Thread (target=pd prepare_data, args=(gui_uid gui_pass, db2_ip, db2_port))
T.s etDaemon (True)
T.s tart ()
Def wt_threading () :
# packaged function to the thread
If (v1. The get ()==1) :
Messagebox. Showinfo (title='did not choose to DB2, message=' you haven't choose master library or library, please choose!!! ')
The else:
Db2_info=ALL_DB2 [v1. The get ()]
Db2_ip=db2_info [2]
Db2_port=db2_info [4]
Comp_flag=v.g et ()
Gui_uid=e1. The get ()
Gui_pass=e2. The get ()
T=threading. Thread (target=wp wt_process, args=(gui_uid gui_pass, comp_flag, db2_ip, db2_port))
T.s etDaemon (True)
T.s tart ()
Def cx_threading () :
# packaged function to the thread
If (v1. The get ()==1) :
Messagebox. Showinfo (title='did not choose to DB2, message=' you haven't choose master library or library, please choose!!! ')
The else:
Db2_info=ALL_DB2 [v1. The get ()]
Db2_ip=db2_info [2]
Db2_port=db2_info [4]
Gui_uid=e1. The get ()
Gui_pass=e2. The get ()
T=threading. Thread (target=cp cx_process, args=(gui_uid gui_pass, db2_ip, db2_port))
T.s etDaemon (True)
T.s tart ()
Def prit () :
If v1. The get ()==0:
Info='main libraries'
Elif v1. The get ()==1:
Info='for libraries'
Messagebox. Showinfo (title=info, message='database of choice at this time is a' + info + ', please confirm that the current environment is the main library or for libraries')
Def is_admin () :
Try:
Return ctypes. Windll. Shell32. IsUserAnAdmin ()
Except:
Return False
If __name__=="__main__ ':
If is_admin () :
Global e1 and e2, v, v1
Root=Tk ()
Root. Geometry (' 1024 x768)
Root. Minsize (1024768)
Root. Maxsize (1024768)
Root. Iconbitmap (". \ \ logo ico ")
Text=tk. Text (root, width=130, height=35)
Text. Place (x=80, y=280)
ALL_DB2={}
ALL_DB2. Setdefault (0, []), append (' main library DB2 configuration, ')
[], ALL_DB2. Setdefault (0) append (' IP:)
[], ALL_DB2. Setdefault (0) append (DB2_DICT [' host '])
[], ALL_DB2. Setdefault (0) append () ', the PORT: '
[], ALL_DB2. Setdefault (0) append (DB2_DICT [' port '])
If BK_DB2_DICT [' host '] :
[], ALL_DB2. Setdefault (1) append (' libraries for DB2 configuration)
[], ALL_DB2. Setdefault (1) append (' IP:)
[], ALL_DB2. Setdefault (1) append (BK_DB2_DICT [' host '])
[], ALL_DB2. Setdefault (1) append () ', the PORT: '
[], ALL_DB2. Setdefault (1) append (BK_DB2_DICT [' port '])
# print (ALL_DB2)
Label (root, text='1, display text 1,' and fg='red',
The anchor='center'). The grid (row=1, sticky=W, columnspan=3)
The Label (root, text='2, 2, and display text, fg=' red ', the anchor='se'). The grid (row=2, sticky=W, columnspan=3)
Label (root, text='please select corresponding DB2 environment, fg=' black '). The grid (row=3, sticky=E, the column=0)
V1=IntVar ()
V1. Set (1)
# v1. Set (0)
If len (ALL_DB2)==1:
V1 set (0)
Row_id=3
For the key and the value in ALL_DB2. The items () :
B=Radiobutton (root, text=value, variable=v1, value=https://bbs.csdn.net/topics/key, command=prit). The grid (row=row_id, column=1, sticky=W,
Columnspan=2)
Row_id +=1
The Label (root, text='please enter the user name: DB2). The grid (row=5, the column=0, sticky=E)
Label (root, text='please enter a password: DB2). The grid (row=6, the column=0, sticky=E)
E1=Entry (root)
E2=Entry (root, show='*')
E1. The grid (row=5, the column=1, sticky=W, columnspan=2)
E2. The grid (row=6, the column=1, sticky=W, columnspan=2)
E1. Delete (0, END)
E2. Delete (0, END)
E1. Insert (0, '* * * * * * *')
E2. Insert (0, '* * * * * * *')
The Button (root, text='step 1: data preparation, the command=data_threading). The grid (row=14, the column=0)
V=IntVar ()
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull