コード例 #1
0
def pay(*args):
    """
    api of atm for user to pay for their shopping cart
    :return:
    """
    amount = args[0]
    if int(amount) == 0:
        print("\033[31;1m请先添加商品!\033[0m")
        return
    shopping_list = args[1]
    acc_data = main.login()
    result = main.pay(acc_data, amount)
    main.logout(acc_data, mode=True)
    if result:
        shopping_list.clear()
        dump_shopping_list(shopping_list)
コード例 #2
0
#     print('welcome to index.html')
#
# @auth(auth_type='local')
# def home():
#     print('welcome to home page')
#     return 'from home'
#
# @auth(auth_type='ldap')
# def bbs():
#     print('welcome to bbs page')
#
# index.html()
# home()
# bbs()

import os
import sys

print(__file__)
print(os.path.abspath(__file__))

BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)

print(BASE_DIR)

from conf import settings
from core import main

main.login()
コード例 #3
0
def signin(self, title1):
    self.destroy()
    self = Tk()
    p1 = PhotoImage(file='res/bit.png')
    self.iconphoto(False, p1)
    height = self.winfo_screenheight()
    width = self.winfo_screenwidth()
    self.maxsize(width, height)
    self.minsize(width - 100, height - 100)
    self.geometry("{0}x{1}+75+75".format(height, width))
    self.title(title1)
    self.config(bg="black")
    img = PhotoImage(file="res/canvalogo1.png")
    label = Label(self, image=img)
    label.place(x=0, y=-1)
    dic = ["Signin", "Create Account", "Exit", "Forgot Password"]
    endis = ["Email", "Password"]
    lb = Label(self,
               text="SignIn to your Account",
               bg="black",
               fg="white",
               font=("comicsansms", 30, "bold"),
               relief=FLAT).place(x=500, y=20)
    lb = Label(self,
               text="If you are a new user than ,",
               bg="black",
               fg="white",
               font=("comicsansms", 12, "bold"),
               relief=FLAT).place(x=610, y=650)
    y, n = 150, None
    for i in endis:
        l = Label(self,
                  text="{0}".format(i),
                  bg="black",
                  fg="Grey",
                  font=("comicsansms", 16, "bold"),
                  relief=FLAT).place(x=50, y=y)
        y += 100
    e0 = Entry(self, relief=FLAT, font=("comicsansms", 20, "bold"))
    e0.place(x=250, y=140)
    e1 = Entry(self, relief=FLAT, show="*", font=("comicsansms", 20, "bold"))
    e1.place(x=250, y=240)
    bt1 = Button(self,
                 activebackground="black",
                 activeforeground="white",
                 text="{0}".format(dic[0]),
                 bg="white",
                 fg="black",
                 font=("comicsansms", 12, "bold"),
                 relief=SUNKEN,
                 borderwidth=3,
                 command=lambda frame1=self: main.login(
                     frame1, e0.get(), e1.get())).place(x=550, y=600)
    bt2 = Button(self,
                 activebackground="black",
                 activeforeground="white",
                 text="{0}".format(dic[1]),
                 bg="black",
                 fg="blue",
                 font=("comicsansms", 7, "bold"),
                 relief=FLAT,
                 borderwidth=-1,
                 command=lambda self=self: create_account_layout.create_ac(
                     self, title1="{0}".format(dic[1]))).place(x=860, y=650)
    bt3 = Button(self,
                 activebackground="black",
                 activeforeground="white",
                 text="{0}".format(dic[2]),
                 bg="white",
                 fg="black",
                 font=("comicsansms", 9, "bold"),
                 relief=SUNKEN,
                 borderwidth=3,
                 command=lambda: self.destroy()).place(x=1286, y=10)
    bt4 = Button(self,
                 activebackground="black",
                 activeforeground="white",
                 text="{0}".format(dic[3]),
                 bg="black",
                 fg="blue",
                 font=("comicsansms", 12, "bold"),
                 relief=FLAT,
                 borderwidth=-1,
                 command=lambda self=self: forgot_password_layout.forgot_lay(
                     self, title1="{0}".format(dic[-1]))).place(x=80, y=600)
    self.mainloop()
コード例 #4
0
#-*- Coding:utf-8 -*-
# Author: D.Gray

import os
print(__file__)  #获取当前程序所在相对路径
print(os.path.abspath(__file__))  #返回绝对路径
print(os.path.dirname(os.path.abspath(__file__)))  #返回目录名,不要文件名

print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))  #返回到ATM目录下
import sys  #添加环境变量
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

sys.path.append(BASE_DIR)
from conf import settings  #导入conf目录中的 settings文件
from core import main  #导入core目录中的 main文件

main.login()  #调用mian文件中的login函数
コード例 #5
0
ファイル: start.py プロジェクト: casc1990/python-s14
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#Author:pengbo
import os,sys
print (sys.path)
print (__file__)   #查看当前文件的相对路径。
print (os.path.abspath(__file__))   #os.path.abspath() 查看文件的绝对路径
abspath = os.path.abspath(__file__)
print (os.path.dirname(abspath))   #os.path.dirname() 查看文件的上级父目录名(/a/b 返回/a)
absdir = os.path.dirname(abspath)
print (os.path.dirname(absdir))  #查看文件的上上级父目录名
print (os.path.dirname(os.path.dirname(os.path.abspath(__file__))))   #获取到项目的根目录
root_absdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root_absdir)
print (sys.path)
from core import main   #导入core目录里的main文件(因为把项目的根目录加入到环境变量中了,所有可以导入)
main.login()      #执行main文件里的login函数
コード例 #6
0
ファイル: atm.py プロジェクト: ChacoLv/python-oldboy
# -*- coding:utf-8 -*-
# LC

import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from core import main
main.login("lvcheng")
コード例 #7
0
ファイル: atm.py プロジェクト: hawahe/leran_frank
import os,sys

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
from core import main

main.login()