How to add gui to my program ?



  • Hello everyone,

    I am unable to solve the following issue. How can I add simple gui to my program ? I made even picture with the design, but I don't know where to add my code in the qt4 designer, so once I click the "ok" button the program to be executed in the terminal with my python script:
    @import hashlib
    import sys
    import binascii
    import re

    #SSIDEND = "1234AB" #example
    if len(sys.argv) < 2:
    print str(len(sys.argv))
    print "Usage: "
    print " python2.6 touchspeedcalc_test.py [SSID]"
    print "Where [SSID] are the last 6 characters of the SSID."
    sys.exit()

    SSIDEND = sys.argv[1].upper()
    #sys.argv[1].decode("hex")

    if len(SSIDEND) == 6:
    #SpeedTouch:
    FINDPOS = 0
    elif len(SSIDEND) == 4:
    #BT HomeHub:
    FINDPOS = 1
    else:
    print "SSID-end must be either 6 or 4 characters."
    sys.exit()

    YEARS = [2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012]
    #YEARS = [ 2009, 2008, 2007, 2006, 2005, 2004, 2010 ]
    #YEAR = sys.argv[2].lower()

    def ascii2hex(char):
    return hex(ord(char))[2:].upper()

    CHARSET = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    BINCODE = binascii.unhexlify("".join(SSIDEND.split()))
    #print "Compressed SSID: ", BINCODE

    for YEAR in YEARS:
    FILE = "db/db_with_keys___" + str(YEAR) + ".dat"
    INFILE = open(FILE,"rb")
    FILEDATA = INFILE.read()
    INFILE.close()
    WHEREFOUND = FILEDATA.find(BINCODE, 0)
    while (WHEREFOUND > -1):
    if WHEREFOUND % 3 == FINDPOS:
    PRODIDNUM = (WHEREFOUND / 3) % (363636)
    PRODWEEK = (WHEREFOUND / 3) / (363636) +1
    PRODID1 = PRODIDNUM / (36*36)
    PRODID2 = (PRODIDNUM / 36) % 36
    PRODID3 = PRODIDNUM % 36
    SERIAL = 'CPdd%s%s%s' % (YEAR-2000,PRODWEEK,ascii2hex(CHARSET[PRODID1:PRODID1+1]),ascii2hex(CHARSET[PRODID2:PRODID2+1]),ascii2hex(CHARSET[PRODID3:PRODID3+1]))
    SHA1SUM = hashlib.sha1(SERIAL).digest().encode("hex").upper()
    SSID = SHA1SUM[-6:]
    ACCESSKEY = SHA1SUM[0:10]
    if len(SSIDEND) == 4:
    # BT HomeHub password is lowercase:
    ACCESSKEY = ACCESSKEY.lower()
    #print "Serial number:", str(SERIAL) # does not give proper serial number for the thompsons BT series
    #print "SHA1SUM:", str(SHA1SUM)
    print "", str(ACCESSKEY)

    WHEREFOUND = FILEDATA.find(BINCODE, WHEREFOUND+1)@
    

    I made and image with the basic concept: http://imgbox.com/abq24DNa



  • Hi,

    Qt Designer is only a GUI Designer; you must create a GUI Application in order to do what you need.

    However, once you created you Application, you can use QProcess to launch external process.

    TIP. You can also use PyQt/PySide and write you application directly in Python



  • QProcess is what I needed, thank you mcosta.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.