Jump to content


P4Python issues

Tkinter python

  • Please log in to reply
No replies to this topic

#1 Duyan

Duyan

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 10 March 2017 - 12:29 AM

Hello all

I am just starting to experiment with Python and GUI with Tkinter and P4Python .

Im just doing a simple script for now that take a Host:port , username and password then try P4.connect() and print worked or failed with the error

i am going to paste my code , i am assuming im doing something wrong because whatever the data a input in i always get ''Invalid Password'' :-/

Can anybody help ?

Thank you

from tkinter import *
from P4 import P4, P4Exception
P4 = P4()
class subAss:
def __init__(self):
  self.root = Tk()
  self.root.title("SubmitAssist Alpha 1")
 
  #Next Button
  self.nextButton = Button(self.root,text='Next', command=self.next_callback)
  self.nextButton.pack()
 
  #Host/port
  self.userHost = StringVar()
  self.hostEntry = Entry(self.root,textvariable=self.userHost)
  self.hostEntry.pack()
  self.host = self.userHost.get()
  P4.port = self.host
  #Username
  self.userName = StringVar()
  self.userEntry = Entry(self.root,textvariable=self.userName)
  self.userEntry.pack()
  self.user = self.userName.get()
  P4.user = self.user
  #Password
  self.passwdInput = StringVar()
  self.passwdEntry = Entry(self.root,textvariable=self.passwdInput)
  self.passwdEntry.pack()
  self.passwd = self.passwdInput.get()
  P4.password = self.passwd
 
 
  self.root.mainloop()
 
def next_callback(self):
 
  try:
   P4.port = self.host
   P4.user = self.user
   P4.password = self.passwd
  
   P4.connect()
   P4.run_login()
   input(" worked ")
  except P4Exception:
   for e in P4.errors:
	print (e)
	input ("failed")
 
subAss()






Also tagged with one or more of these keywords: Tkinter, python

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users