def active(self): if self.controller.api is None: self.controller.show_frame(Login) Base.active(self) self.text.delete(1.0, tk.END) self.updateLog('%s Set Bid Options...\n' % (time.strftime('%Y-%m-%d %H:%M:%S'))) self.controller.status.set_status('Set Bid Options...') self.tree.delete(*self.tree.get_children()) for item in self.args['playerList']: displayName = item['player']['commonName'] if item['player'][ 'commonName'] is not '' else item['player']['lastName'] try: self.tree.insert('', 'end', item['player']['id'], text=displayName, values=(item['buy'], item['sell'], item['bin'])) except: pass self._lastUpdate = 0 self._updatedItems = [] self.auctionsWon = 0 self.sold = 0
def __init__(self, master, controller): Base.__init__(self, master, controller) self._watching = False self._errorCount = 0 self.q = mp.Queue() self.p = None options = tk.Frame(self, bg='#1d93ab') options.grid(column=0, row=0, sticky='ns') stats = tk.Frame(self, bg='#1d93ab') stats.grid(column=1, row=0, pady=50, sticky='ns') self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=0) self.grid_columnconfigure(1, weight=1) back = tk.Button(options, bg='#1d93ab', text='Back to Player Search', command=self.show_playersearch) back.grid(column=0, row=0, sticky='we') self.card = tk.Label(options, bg='#1d93ab') self.card.grid(column=0, row=1) descLbl = tk.Label(stats, text='We are watching all of the trades for the next 20 minutes, and reporting below:', bg='#1d93ab', fg='#ffeb7e') descLbl.grid(column=0, row=0, columnspan=2) watchLbl = tk.Label(stats, text='Watched Trades:', bg='#1d93ab', fg='#ffeb7e') watchLbl.grid(column=0, row=1, sticky='e') self.numwatch = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.numwatch.grid(column=1, row=1) activeLbl = tk.Label(stats, text='Active Trades:', bg='#1d93ab', fg='#ffeb7e') activeLbl.grid(column=0, row=2, sticky='e') self.numactive = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.numactive.grid(column=1, row=2) bidLbl = tk.Label(stats, text='Trades with a Bid:', bg='#1d93ab', fg='#ffeb7e') bidLbl.grid(column=0, row=3, sticky='e') self.numbid = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.numbid.grid(column=1, row=3) lowLbl = tk.Label(stats, text='Lowest Bid:', bg='#1d93ab', fg='#ffeb7e') lowLbl.grid(column=0, row=4, sticky='e') self.low = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.low.grid(column=1, row=4) midLbl = tk.Label(stats, text='Median Bid:', bg='#1d93ab', fg='#ffeb7e') midLbl.grid(column=0, row=5, sticky='e') self.mid = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.mid.grid(column=1, row=5) avgLbl = tk.Label(stats, text='Average Bid:', bg='#1d93ab', fg='#ffeb7e') avgLbl.grid(column=0, row=6, sticky='e') self.avg = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.avg.grid(column=1, row=6) lowUnsoldLbl = tk.Label(stats, text='Lowest UNSOLD List Price:', bg='#1d93ab', fg='#ffeb7e') lowUnsoldLbl.grid(column=0, row=7, sticky='e') self.lowUnsold = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.lowUnsold.grid(column=1, row=7) self.checkQueue()
def active(self): Base.active(self) if self.controller.api is None: self.controller.show_frame(Login) # Backwards compatability if isinstance(self._playerFile, list): self._playerList = self._playerFile self._playerFile = {self.controller.user: self._playerList} self.save_list() # Check if we have a list for this user if self.controller.user not in self._playerFile: self._playerFile[self.controller.user] = [] self._playerList = self._playerFile[self.controller.user] for item in self._playerList: self.add_player(item, write=False)
def active(self): if self.controller.api is None: self.controller.show_frame(Login) Base.active(self) self.text.delete(1.0, tk.END) self.updateLog('%s Set Bid Options...\n' % (time.strftime('%Y-%m-%d %H:%M:%S'))) self.controller.status.set_status('Set Bid Options...') self.tree.delete(*self.tree.get_children()) for item in self.args['playerList']: displayName = item['player']['commonName'] if item['player']['commonName'] is not '' else item['player']['lastName'] try: self.tree.insert('', 'end', item['player']['id'], text=displayName, values=(item['buy'], item['sell'], item['bin'])) except: pass self._lastUpdate = 0 self._updatedItems = [] self.auctionsWon = 0 self.sold = 0
def active(self): if self.controller.api is None: self.controller.show_frame(Login) Base.active(self) displayName = self.args['player']['commonName'] if self.args['player']['commonName'] is not '' else self.args['player']['lastName'] self.controller.status.set_status('Watching auctions for %s...' % displayName) img = ImageTk.PhotoImage(create(self.args['player'])) self.card.config(image=img) self.card.image = img self.numwatch.config(text='0') self.numactive.config(text='0') self.numbid.config(text='0') self.low.config(text='0') self.mid.config(text='0') self.avg.config(text='0') self.lowUnsold.config(text='0') self.update_idletasks() self.watch()
def active(self): Base.active(self) if self.controller.api is None: self.controller.show_frame(Login) # Backwards compatability if isinstance(self._playerFile, list): self._playerList = self._playerFile self._playerFile = { self.controller.user: self._playerList } self.save_list() # Check if we have a list for this user if self.controller.user not in self._playerFile: self._playerFile[self.controller.user] = [] self._playerList = self._playerFile[self.controller.user] for item in self._playerList: self.add_player(item, write=False)
def active(self): if self.controller.api is None: self.controller.show_frame(Login) Base.active(self) displayName = self.args['player']['commonName'] if self.args['player'][ 'commonName'] is not '' else self.args['player']['lastName'] self.controller.status.set_status('Watching auctions for %s...' % displayName) img = ImageTk.PhotoImage(create(self.args['player'])) self.card.config(image=img) self.card.image = img self.numwatch.config(text='0') self.numactive.config(text='0') self.numbid.config(text='0') self.low.config(text='0') self.mid.config(text='0') self.avg.config(text='0') self.lowUnsold.config(text='0') self.update_idletasks() self.watch()
def active(self): Base.active(self) self.logout(switchFrame=False)
def __init__(self, master, controller): #init Base Base.__init__(self, master, controller) # Values self.controller = controller self.username = tk.StringVar() self.password = tk.StringVar() self.secret = tk.StringVar() self.code = tk.StringVar() self.platform = tk.StringVar() self.emulate = tk.StringVar() self.debug = tk.IntVar() self.data = [] self._keepalive = None # Search for settings try: with open(constants.LOGIN_FILE, 'r') as f: self.data = json.load(f) if not isinstance(self.data, list): self.data = [self.data] self.username.set(self.data[0]['username']) self.password.set(self.data[0]['password']) self.secret.set(self.data[0]['secret']) self.code.set(self.data[0]['code']) self.platform.set(self.data[0]['platform']) self.emulate.set(self.data[0]['emulate']) except: self.platform.set('xbox') self.emulate.set('pc') mainframe = tk.Frame(self, bg='#1d93ab') mainframe.pack(expand=True) self.loginlbl = tk.Label( mainframe, text= '\nWe need to collect your login information in order to connect to the FIFA servers. This information will be saved on your computer for future use.', anchor='w', justify='left', wraplength=500, fg='#fff', bg='#1d93ab', font=('KnulBold', 16)) # self.loginlbl.grid(column=0, row=0) self.loginlbl.pack() loginfr = tk.Frame(mainframe) # loginfr.grid(column=0, row=1, sticky='ns') loginfr.pack() # init user input userlbl = tk.Label(loginfr, text='Email:', font=('KnulBold', 16, 'bold')) userlbl.grid(column=0, row=1, sticky='e', padx=5, pady=5) userbox = tk.Entry(loginfr, textvariable=self.username) userbox.bind('<KeyRelease>', self.search) userbox.grid(column=1, row=1, sticky='w', padx=5, pady=5) passlbl = tk.Label(loginfr, text='Password:'******'KnulBold', 16, 'bold')) passlbl.grid(column=0, row=2, sticky='e', padx=5, pady=5) passbox = tk.Entry(loginfr, textvariable=self.password, show='*') passbox.grid(column=1, row=2, sticky='w', padx=5, pady=5) secretlbl = tk.Label(loginfr, text='Secret Question:', font=('KnulBold', 16, 'bold')) secretlbl.grid(column=0, row=3, sticky='e', padx=5, pady=5) secretbox = tk.Entry(loginfr, textvariable=self.secret, show='*') secretbox.grid(column=1, row=3, sticky='w', padx=5, pady=5) codelbl = tk.Label(loginfr, text='Access Code:', font=('KnulBold', 16, 'bold')) codelbl.grid(column=0, row=4, sticky='e', padx=5, pady=5) codebox = tk.Entry(loginfr, textvariable=self.code) codebox.grid(column=1, row=4, sticky='w', padx=5, pady=5) platformlbl = tk.Label(loginfr, text='Platform:', font=('KnulBold', 16, 'bold')) platformlbl.grid(column=0, row=5, sticky='e', padx=5, pady=5) platformsel = tk.OptionMenu(loginfr, self.platform, 'pc', 'xbox', 'xbox360', 'ps3', 'ps4') platformsel.grid(column=1, row=5, sticky='w', padx=5, pady=5) emulatelbl = tk.Label(loginfr, text='Emulate:', font=('KnulBold', 16, 'bold')) emulatelbl.grid(column=0, row=6, sticky='e', padx=5, pady=5) emulatesel = tk.OptionMenu(loginfr, self.emulate, 'pc', 'android', 'iOS') emulatesel.grid(column=1, row=6, sticky='w', padx=5, pady=5) # debugLbl = tk.Label(loginfr, text='Enable Debug:', font=('KnulBold', 16, 'bold')) # debugLbl.grid(column=0, row=7, sticky='e') # debugCheckbox = tk.Checkbutton(loginfr, variable=self.debug) # debugCheckbox.grid(column=1, row=7, sticky='w') loginbtn = tk.Button(loginfr, text='Login', command=self.login) loginbtn.grid(column=0, row=7, columnspan=2, padx=5, pady=5)
def __init__(self, master, controller): Base.__init__(self, master, controller) loading = ImageTk.PhotoImage(Image.open('images/loading.jpg')) label = tk.Label(self, bg='#1d93ab', image=loading) label.image = loading label.pack(expand=True)
def __init__(self, master, controller): Base.__init__(self, master, controller) self._bidding = False self._bidCycle = 0 self._errorCount = 0 self._banWait = 0 self._startTime = 0 self._lastUpdate = 0 self._updatedItems = [] self.auctionsWon = 0 self.sold = 0 self.q = mp.Queue() self.p = None self.rpm = tk.StringVar() self.minCredits = tk.StringVar() self.maxPlayer = tk.StringVar() self.autoUpdate = tk.IntVar() self.buy = tk.StringVar() self.sell = tk.StringVar() self.bin = tk.StringVar() self.settings = { 'rpm': 20, 'minCredits': 1000, 'maxPlayer': 20, 'autoUpdate': 0, 'buy': 0.9, 'sell': 1, 'bin': 1.25 } # Search for settings try: with open('config/settings.json', 'r') as f: self.settings = json.load(f) except FileNotFoundError: pass # Set initial values self.rpm.set(self.settings['rpm']) self.minCredits.set(self.settings['minCredits']) self.maxPlayer.set(self.settings['maxPlayer']) self.autoUpdate.set(self.settings['autoUpdate']) self.buy.set(int(self.settings['buy']*100)) self.sell.set(int(self.settings['sell']*100)) self.bin.set(int(self.settings['bin']*100)) # Setup traces self.rpm.trace('w', self.save_settings) self.minCredits.trace('w', self.save_settings) self.maxPlayer.trace('w', self.save_settings) self.autoUpdate.trace('w', self.save_settings) self.buy.trace('w', self.save_settings) self.sell.trace('w', self.save_settings) self.bin.trace('w', self.save_settings) # Setup GUI options = tk.Frame(self) options.grid(column=0, row=0, sticky='ns') self.text = tk.Text(self, bg='#1d93ab', fg='#ffeb7e', bd=0) self.text.grid(column=1, row=0, sticky='news') self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=0) self.grid_columnconfigure(1, weight=1) back = tk.Button(options, bg='#1d93ab', text='Back to Player Search', command=self.playersearch) back.grid(column=0, row=0, sticky='we') self.tree = ttk.Treeview(options, columns=('buy', 'sell', 'bin'), selectmode='browse') self.tree.column('buy', width=50, anchor='center') self.tree.heading('buy', text='Max Bid') self.tree.column('sell', width=50, anchor='center') self.tree.heading('sell', text='Sell') self.tree.column('bin', width=50, anchor='center') self.tree.heading('bin', text='BIN') self.tree.grid(column=0, row=1, sticky='ns') form = tk.Frame(options, padx=15, pady=15) form.grid(column=0, row=2) options.grid_columnconfigure(0, weight=1) options.grid_rowconfigure(0, weight=0) options.grid_rowconfigure(1, weight=1) options.grid_rowconfigure(2, weight=0) rpmLbl = tk.Label(form, text='RPM:') rpmLbl.grid(column=0, row=0, sticky='e') rpmEntry = tk.Entry(form, width=8, textvariable=self.rpm) rpmEntry.grid(column=1, row=0, sticky='w') minCreditsLbl = tk.Label(form, text='Min Credits:') minCreditsLbl.grid(column=0, row=1, sticky='e') minCreditsEntry = tk.Entry(form, width=8, textvariable=self.minCredits) minCreditsEntry.grid(column=1, row=1, sticky='w') maxPlayerLbl = tk.Label(form, text='Max Players:') maxPlayerLbl.grid(column=0, row=2, sticky='e') maxPlayerEntry = tk.Entry(form, width=8, textvariable=self.maxPlayer) maxPlayerEntry.grid(column=1, row=2, sticky='w') autoUpdateLbl = tk.Label(form, text='Auto Update Pricing:') autoUpdateLbl.grid(column=0, row=3, sticky='e') autoUpdateEntry = tk.Checkbutton(form, variable=self.autoUpdate) autoUpdateEntry.grid(column=1, row=3, sticky='w') autoBuyLbl = tk.Label(form, text='Auto Bid %:') autoBuyLbl.grid(column=0, row=4, sticky='e') autoBuyEntry = tk.Entry(form, width=8, textvariable=self.buy) autoBuyEntry.grid(column=1, row=4, sticky='w') autoSellLbl = tk.Label(form, text='Auto Sell %:') autoSellLbl.grid(column=0, row=5, sticky='e') autoSellEntry = tk.Entry(form, width=8, textvariable=self.sell) autoSellEntry.grid(column=1, row=5, sticky='w') autoBINLbl = tk.Label(form, text='Auto BIN %:') autoBINLbl.grid(column=0, row=6, sticky='e') autoBINEntry = tk.Entry(form, width=8, textvariable=self.bin) autoBINEntry.grid(column=1, row=6, sticky='w') self.bidbtn = tk.Button(form, text='Start Bidding', command=self.start) self.bidbtn.grid(column=0, row=7, columnspan=2, padx=5, pady=5) self.checkQueue() self.clearErrors()
def __init__(self, master, controller): Base.__init__(self, master, controller) self._bidding = False self._bidCycle = 0 self._errorCount = 0 self._banWait = 0 self._startTime = 0 self._lastUpdate = 0 self._updatedItems = [] self.auctionsWon = 0 self.sold = 0 options = tk.Frame(self) options.grid(column=0, row=0, sticky='ns') self.text = tk.Text(self, bg='#1d93ab', fg='#ffeb7e', bd=0) self.text.grid(column=1, row=0, sticky='news') self.q = mp.Queue() self.p = None self.minCredits = tk.StringVar() self.minCredits.set(1000) self.autoUpdate = tk.IntVar() self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=0) self.grid_columnconfigure(1, weight=1) back = tk.Button(options, bg='#1d93ab', text='Back to Player Search', command=self.playersearch) back.grid(column=0, row=0, sticky='we') self.tree = ttk.Treeview(options, columns=('buy', 'sell', 'bin'), selectmode='browse') self.tree.column('buy', width=50, anchor='center') self.tree.heading('buy', text='Max Bid') self.tree.column('sell', width=50, anchor='center') self.tree.heading('sell', text='Sell') self.tree.column('bin', width=50, anchor='center') self.tree.heading('bin', text='BIN') self.tree.grid(column=0, row=1, sticky='ns') form = tk.Frame(options, padx=15, pady=15) form.grid(column=0, row=2) options.grid_columnconfigure(0, weight=1) options.grid_rowconfigure(0, weight=0) options.grid_rowconfigure(1, weight=1) options.grid_rowconfigure(2, weight=0) minCreditsLbl = tk.Label(form, text='Min Credits:') minCreditsLbl.grid(column=0, row=0, sticky='e') minCreditsEntry = tk.Entry(form, width=8, textvariable=self.minCredits) minCreditsEntry.grid(column=1, row=0, sticky='w') autoUpdateLbl = tk.Label(form, text='Auto Update Pricing:') autoUpdateLbl.grid(column=0, row=1, sticky='e') autoUpdateEntry = tk.Checkbutton(form, variable=self.autoUpdate) autoUpdateEntry.grid(column=1, row=1, sticky='w') self.bidbtn = tk.Button(form, text='Start Bidding', command=self.start) self.bidbtn.grid(column=0, row=2, columnspan=2, padx=5, pady=5) self.checkQueue() self.clearErrors()
def __init__(self, master, controller): Base.__init__(self, master, controller) self.master = master self.url = 'https://www.easports.com/uk/fifa/ultimate-team/api/fut/item' self._job = None self.player = tk.StringVar() self._playerName = '' search = tk.Entry(self, textvariable=self.player) search.bind('<KeyRelease>', self.search) search.bind('<Return>', self.lookup) search.grid(column=0, row=0, columnspan=2, sticky='we') # preload cards and info self.cards = { 'group0': Image.open('images/cards/group0.png'), 'group1': Image.open('images/cards/group1.png'), 'group2': Image.open('images/cards/group2.png') } with open('images/cards/cards_big.json', 'r') as f: self.cardinfo = json.load(f) self.cardLabels = None # create scrolling frame # create a canvas object and a vertical scrollbar for scrolling it hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL) hscrollbar.grid(column=0, row=2, columnspan=2, sticky='we') canvas = tk.Canvas(self, bd=0, highlightthickness=0, bg='#1d93ab', xscrollcommand=hscrollbar.set) canvas.grid(column=0, row=1, columnspan=2, sticky='news') hscrollbar.config(command=canvas.xview) # reset the view canvas.xview_moveto(0) canvas.yview_moveto(0) # create a frame inside the canvas which will be scrolled with it self.interior = interior = tk.Frame(canvas, bg='#1d93ab') interior_id = canvas.create_window(0, 0, window=interior, anchor=tk.NW) # track changes to the canvas and frame width and sync them, # also updating the scrollbar def _configure_interior(event): # update the scrollbars to match the size of the inner frame size = (interior.winfo_reqwidth(), interior.winfo_reqheight()) canvas.config(scrollregion="0 0 %s %s" % size) if interior.winfo_reqheight() != canvas.winfo_height(): # update the canvas's width to fit the inner frame canvas.config(height=interior.winfo_reqheight()) interior.bind('<Configure>', _configure_interior) def _configure_canvas(event): if interior.winfo_reqheight() != canvas.winfo_height(): # update the inner frame's width to fill the canvas canvas.itemconfigure(interior_id, height=canvas.winfo_height()) canvas.bind('<Configure>', _configure_canvas) # Add a treeview to display selected players self.tree = EditableTreeview(self, columns=('position', 'rating', 'buy', 'sell', 'bin', 'actions'), selectmode='browse', height=8) self.tree.heading('#0', text='Name', anchor='w') self.tree.column('position', width=100, anchor='center') self.tree.heading('position', text='Position') self.tree.column('rating', width=100, anchor='center') self.tree.heading('rating', text='Rating') self.tree.column('buy', width=100, anchor='center') self.tree.heading('buy', text='Purchase For') self.tree.column('sell', width=100, anchor='center') self.tree.heading('sell', text='Sell For') self.tree.column('bin', width=100, anchor='center') self.tree.heading('bin', text='Sell For BIN') self.tree.column('actions', width=20, anchor='center') self.tree.bind('<<TreeviewInplaceEdit>>', self._on_inplace_edit) self.tree.bind('<<TreeviewCellEdited>>', self._on_cell_edited) self.tree.grid(column=0, row=3, columnspan=2, sticky='we') watchbtn = tk.Button(self, text='Watch Player', command=self.show_watch) watchbtn.grid(column=0, row=4, sticky='we') bidbtn = tk.Button(self, text='Start Bidding', command=self.show_bid) bidbtn.grid(column=1, row=4, sticky='we') self._del_btn = tk.Button(self.tree, text='-', command=self._on_del_clicked) # Search for existing list self._playerFile = {} self._playerList = [] try: with open(constants.PLAYERS_FILE, 'r') as f: self._playerFile = json.load(f) self._playerList = [] except: pass self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(1, weight=1) self.grid_rowconfigure(0, weight=0) self.grid_rowconfigure(1, weight=1) self.grid_rowconfigure(2, weight=0) self.grid_rowconfigure(3, weight=0) self.grid_rowconfigure(4, weight=0)
def __init__(self, master, controller): #init Base Base.__init__(self, master, controller) # Values self.controller = controller self.username = tk.StringVar() self.password = tk.StringVar() self.secret = tk.StringVar() self.code = tk.StringVar() self.platform = tk.StringVar() self.emulate = tk.StringVar() self.debug = tk.IntVar() self.data = [] self._keepalive = None # Search for settings try: with open(constants.LOGIN_FILE, 'r') as f: self.data = json.load(f) if not isinstance(self.data, list): self.data = [self.data] self.username.set(self.data[0]['username']) self.password.set(self.data[0]['password']) self.secret.set(self.data[0]['secret']) self.code.set(self.data[0]['code']) self.platform.set(self.data[0]['platform']) self.emulate.set(self.data[0]['emulate']) except: self.platform.set('xbox') self.emulate.set('pc') mainframe = tk.Frame(self, bg='#1d93ab') mainframe.pack(expand=True) self.loginlbl = tk.Label( mainframe, text='\nWe need to collect your login information in order to connect to the FIFA servers. This information will be saved on your computer for future use.', anchor='w', justify='left', wraplength=500, fg='#fff', bg='#1d93ab', font=('KnulBold', 16) ) # self.loginlbl.grid(column=0, row=0) self.loginlbl.pack() loginfr = tk.Frame(mainframe) # loginfr.grid(column=0, row=1, sticky='ns') loginfr.pack() # init user input userlbl = tk.Label(loginfr, text='Email:', font=('KnulBold', 16, 'bold')) userlbl.grid(column=0, row=1, sticky='e', padx=5, pady=5) userbox = tk.Entry(loginfr, textvariable=self.username) userbox.bind('<KeyRelease>', self.search) userbox.grid(column=1, row=1, sticky='w', padx=5, pady=5) passlbl = tk.Label(loginfr, text='Password:'******'KnulBold', 16, 'bold')) passlbl.grid(column=0, row=2, sticky='e', padx=5, pady=5) passbox = tk.Entry(loginfr, textvariable=self.password, show='*') passbox.grid(column=1, row=2, sticky='w', padx=5, pady=5) secretlbl = tk.Label(loginfr, text='Secret Question:', font=('KnulBold', 16, 'bold')) secretlbl.grid(column=0, row=3, sticky='e', padx=5, pady=5) secretbox = tk.Entry(loginfr, textvariable=self.secret, show='*') secretbox.grid(column=1, row=3, sticky='w', padx=5, pady=5) codelbl = tk.Label(loginfr, text='Access Code:', font=('KnulBold', 16, 'bold')) codelbl.grid(column=0, row=4, sticky='e', padx=5, pady=5) codebox = tk.Entry(loginfr, textvariable=self.code) codebox.grid(column=1, row=4, sticky='w', padx=5, pady=5) platformlbl = tk.Label(loginfr, text='Platform:', font=('KnulBold', 16, 'bold')) platformlbl.grid(column=0, row=5, sticky='e', padx=5, pady=5) platformsel = tk.OptionMenu(loginfr, self.platform, 'pc', 'xbox', 'xbox360', 'ps3', 'ps4') platformsel.grid(column=1, row=5, sticky='w', padx=5, pady=5) emulatelbl = tk.Label(loginfr, text='Emulate:', font=('KnulBold', 16, 'bold')) emulatelbl.grid(column=0, row=6, sticky='e', padx=5, pady=5) emulatesel = tk.OptionMenu(loginfr, self.emulate, 'pc', 'android', 'iOS') emulatesel.grid(column=1, row=6, sticky='w', padx=5, pady=5) # debugLbl = tk.Label(loginfr, text='Enable Debug:', font=('KnulBold', 16, 'bold')) # debugLbl.grid(column=0, row=7, sticky='e') # debugCheckbox = tk.Checkbutton(loginfr, variable=self.debug) # debugCheckbox.grid(column=1, row=7, sticky='w') loginbtn = tk.Button(loginfr, text='Login', command=self.login) loginbtn.grid(column=0, row=7, columnspan=2, padx=5, pady=5)
def active(self): Base.active(self) if self.controller.api is None: self.controller.show_frame(Login)
def __init__(self, master, controller): Base.__init__(self, master, controller) self.master = master self.url = 'https://www.easports.com/uk/fifa/ultimate-team/api/fut/item' self._job = None self.player = tk.StringVar() self._playerName = '' search = tk.Entry(self, textvariable=self.player) search.bind('<KeyRelease>', self.search) search.bind('<Return>', self.lookup) search.grid(column=0, row=0, columnspan=2, sticky='we') #preload cards and info self.cards = { 'group0': Image.open('images/cards/group0.png'), 'group1': Image.open('images/cards/group1.png'), 'group2': Image.open('images/cards/group2.png') } with open('images/cards/cards_big.json', 'r') as f: self.cardinfo = json.load(f) self.cardLabels = None #create scrolling frame # create a canvas object and a vertical scrollbar for scrolling it hscrollbar = tk.Scrollbar(self, orient=tk.HORIZONTAL) hscrollbar.grid(column=0, row=2, columnspan=2, sticky='we') canvas = tk.Canvas(self, bd=0, highlightthickness=0, bg='#1d93ab', xscrollcommand=hscrollbar.set) canvas.grid(column=0, row=1, columnspan=2, sticky='news') hscrollbar.config(command=canvas.xview) # reset the view canvas.xview_moveto(0) canvas.yview_moveto(0) # create a frame inside the canvas which will be scrolled with it self.interior = interior = tk.Frame(canvas, bg='#1d93ab') interior_id = canvas.create_window(0, 0, window=interior, anchor=tk.NW) # track changes to the canvas and frame width and sync them, # also updating the scrollbar def _configure_interior(event): # update the scrollbars to match the size of the inner frame size = (interior.winfo_reqwidth(), interior.winfo_reqheight()) canvas.config(scrollregion="0 0 %s %s" % size) if interior.winfo_reqheight() != canvas.winfo_height(): # update the canvas's width to fit the inner frame canvas.config(height=interior.winfo_reqheight()) interior.bind('<Configure>', _configure_interior) def _configure_canvas(event): if interior.winfo_reqheight() != canvas.winfo_height(): # update the inner frame's width to fill the canvas canvas.itemconfigure(interior_id, height=canvas.winfo_height()) canvas.bind('<Configure>', _configure_canvas) # Add a treeview to display selected players self.tree = EditableTreeview(self, columns=('position', 'rating', 'buy', 'sell', 'bin', 'actions'), selectmode='browse', height=8) self.tree.column('position', width=100, anchor='center') self.tree.heading('position', text='Position') self.tree.column('rating', width=100, anchor='center') self.tree.heading('rating', text='Rating') self.tree.column('buy', width=100, anchor='center') self.tree.heading('buy', text='Purchase For') self.tree.column('sell', width=100, anchor='center') self.tree.heading('sell', text='Sell For') self.tree.column('bin', width=100, anchor='center') self.tree.heading('bin', text='Sell For BIN') self.tree.column('actions', width=20, anchor='center') self.tree.bind('<<TreeviewInplaceEdit>>', self._on_inplace_edit) self.tree.bind('<<TreeviewCellEdited>>', self._on_cell_edited) self.tree.grid(column=0, row=3, columnspan=2, sticky='we') watchbtn = tk.Button(self, text='Watch Player', command=self.show_watch) watchbtn.grid(column=0, row=4, sticky='we') bidbtn = tk.Button(self, text='Start Bidding', command=self.show_bid) bidbtn.grid(column=1, row=4, sticky='we') self._del_btn = tk.Button(self.tree, text='-', command=self._on_del_clicked) # Search for existing list try: with open('config/players.json', 'r') as f: self._playerList = json.load(f) except: self._playerList = [] for item in self._playerList: self.add_player(item, write=False) self.grid_columnconfigure(0, weight=1) self.grid_columnconfigure(1, weight=1) self.grid_rowconfigure(0, weight=0) self.grid_rowconfigure(1, weight=1) self.grid_rowconfigure(2, weight=0) self.grid_rowconfigure(3, weight=0) self.grid_rowconfigure(4, weight=0)
def __init__(self, master, controller): #init Base Base.__init__(self, master, controller) # Values self.controller = controller self.username = tk.StringVar() self.password = tk.StringVar() self.secret = tk.StringVar() self.code = tk.StringVar() self.platform = tk.StringVar() self.data = {} self._keepalive = None # Search for settings try: with open('config/login.json', 'r') as f: self.data = json.load(f) self.username.set(self.data['username']) self.password.set(self.data['password']) self.secret.set(self.data['secret']) self.code.set(self.data['code']) self.platform.set(self.data['platform']) except FileNotFoundError as e: self.platform.set('xbox') mainframe = tk.Frame(self, bg='#1d93ab') mainframe.pack(expand=True) self.loginlbl = tk.Label( mainframe, text='\nWe need to collect your login information in order to connect to the FIFA servers. This information will be saved on your computer for future use.', anchor='w', justify='left', wraplength=500, fg='#fff', bg='#1d93ab', font=('KnulBold', 16) ) # self.loginlbl.grid(column=0, row=0) self.loginlbl.pack() loginfr = tk.Frame(mainframe) # loginfr.grid(column=0, row=1, sticky='ns') loginfr.pack() # init user input userlbl = tk.Label(loginfr, text='Email:', font=('KnulBold', 16, 'bold')) userlbl.grid(column=0, row=1, sticky='e', padx=5, pady=5) userbox = tk.Entry(loginfr, textvariable=self.username) userbox.grid(column=1, row=1, sticky='w', padx=5, pady=5) passlbl = tk.Label(loginfr, text='Password:'******'KnulBold', 16, 'bold')) passlbl.grid(column=0, row=2, sticky='e', padx=5, pady=5) passbox = tk.Entry(loginfr, textvariable=self.password, show='*') passbox.grid(column=1, row=2, sticky='w', padx=5, pady=5) secretlbl = tk.Label(loginfr, text='Secret Question:', font=('KnulBold', 16, 'bold')) secretlbl.grid(column=0, row=3, sticky='e', padx=5, pady=5) secretbox = tk.Entry(loginfr, textvariable=self.secret, show='*') secretbox.grid(column=1, row=3, sticky='w', padx=5, pady=5) codelbl = tk.Label(loginfr, text='Access Code:', font=('KnulBold', 16, 'bold')) codelbl.grid(column=0, row=4, sticky='e', padx=5, pady=5) codebox = tk.Entry(loginfr, textvariable=self.code) codebox.grid(column=1, row=4, sticky='w', padx=5, pady=5) platformlbl = tk.Label(loginfr, text='Platform:', font=('KnulBold', 16, 'bold')) platformlbl.grid(column=0, row=5, sticky='e', padx=5, pady=5) platformsel = tk.OptionMenu(loginfr, self.platform, 'pc', 'xbox', 'xbox360', 'ps3', 'ps4') platformsel.grid(column=1, row=5, sticky='w', padx=5, pady=5) loginbtn = tk.Button(loginfr, text='Login', command=self.login) loginbtn.grid(column=0, row=6, columnspan=2, padx=5, pady=5)
def __init__(self, master, controller): Base.__init__(self, master, controller) self._bidding = False self._bidCycle = 0 self._errorCount = 0 self._banWait = 0 self._startTime = 0 self._lastUpdate = 0 self._updatedItems = [] self.auctionsWon = 0 self.sold = 0 self.q = mp.Queue() self.p = None self.rpm = tk.StringVar() self.minCredits = tk.StringVar() self.maxPlayer = tk.StringVar() self.autoUpdate = tk.IntVar() self.buy = tk.StringVar() self.sell = tk.StringVar() self.bin = tk.StringVar() self.snipeOnly = tk.IntVar() self.relistAll = tk.IntVar() self.settings = { 'rpm': 20, 'minCredits': 1000, 'maxPlayer': 20, 'autoUpdate': 0, 'buy': 0.9, 'sell': 1, 'bin': 1.25, 'snipeOnly': 0, 'relistAll': 1 } # Search for settings try: with open(constants.SETTINGS_FILE, 'r') as f: self.settings.update(json.load(f)) except: pass # Set initial values self.rpm.set(self.settings['rpm']) self.minCredits.set(self.settings['minCredits']) self.maxPlayer.set(self.settings['maxPlayer']) self.autoUpdate.set(self.settings['autoUpdate']) self.buy.set(int(self.settings['buy']*100)) self.sell.set(int(self.settings['sell']*100)) self.bin.set(int(self.settings['bin']*100)) self.snipeOnly.set(self.settings['snipeOnly']) self.relistAll.set(self.settings['relistAll']) # Setup traces self.rpm.trace('w', self.save_settings) self.minCredits.trace('w', self.save_settings) self.maxPlayer.trace('w', self.save_settings) self.autoUpdate.trace('w', self.save_settings) self.buy.trace('w', self.save_settings) self.sell.trace('w', self.save_settings) self.bin.trace('w', self.save_settings) self.snipeOnly.trace('w', self.save_settings) self.relistAll.trace('w', self.save_settings) # Setup GUI options = tk.Frame(self) options.grid(column=0, row=0, sticky='ns') auctions = tk.Frame(self) self.auctionStatus = Auctions(auctions) self.auctionStatus.get_view().grid(column=0, row=0, sticky='nsew') self.logView = tk.Text(auctions, bg='#1d93ab', fg='#ffeb7e', bd=0) self.logView.grid(column=0, row=1, sticky='nsew') auctions.grid(column=1, row=0, sticky='nsew') auctions.grid_rowconfigure(0, weight=3) auctions.grid_rowconfigure(1, weight=1) auctions.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=0) self.grid_columnconfigure(1, weight=1) back = tk.Button(options, bg='#1d93ab', text='Back to Player Search', command=self.playersearch) back.grid(column=0, row=0, sticky='we') self.tree = ttk.Treeview(options, columns=('buy', 'sell', 'bin', 'won'), selectmode='browse') self.tree.heading('#0', text='Name', anchor='w') self.tree.column('buy', width=50, anchor='center') self.tree.heading('buy', text='Max Bid') self.tree.column('sell', width=50, anchor='center') self.tree.heading('sell', text='Sell') self.tree.column('bin', width=50, anchor='center') self.tree.heading('bin', text='BIN') self.tree.column('won', width=50, anchor='center') self.tree.heading('won', text='# Won') self.tree.grid(column=0, row=1, sticky='ns') form = tk.Frame(options, padx=15, pady=15) form.grid(column=0, row=2) options.grid_columnconfigure(0, weight=1) options.grid_rowconfigure(0, weight=0) options.grid_rowconfigure(1, weight=1) options.grid_rowconfigure(2, weight=0) settingsLbl = tk.Label(form, text='Settings', font=('KnulBold', 16)) settingsLbl.grid(column=0, row=0, columnspan=2) rpmLbl = tk.Label(form, text='RPM:') rpmLbl.grid(column=0, row=1, sticky='e') rpmEntry = tk.Entry(form, width=8, textvariable=self.rpm) rpmEntry.grid(column=1, row=1, sticky='w') minCreditsLbl = tk.Label(form, text='Min $:') minCreditsLbl.grid(column=0, row=2, sticky='e') minCreditsEntry = tk.Entry(form, width=8, textvariable=self.minCredits) minCreditsEntry.grid(column=1, row=2, sticky='w') maxPlayerLbl = tk.Label(form, text='Max Cards:') maxPlayerLbl.grid(column=0, row=3, sticky='e') maxPlayerEntry = tk.Entry(form, width=8, textvariable=self.maxPlayer) maxPlayerEntry.grid(column=1, row=3, sticky='w') snipeOnlyLbl = tk.Label(form, text='BIN Snipe:') snipeOnlyLbl.grid(column=0, row=4, sticky='e') snipeOnlyCheckbox = tk.Checkbutton(form, variable=self.snipeOnly) snipeOnlyCheckbox.grid(column=1, row=4, sticky='w') pricingLbl = tk.Label(form, text='Pricing', font=('KnulBold', 16)) pricingLbl.grid(column=2, row=0, columnspan=2) autoUpdateLbl = tk.Label(form, text='Auto Update:') autoUpdateLbl.grid(column=2, row=1, sticky='e') autoUpdateCheckbox = tk.Checkbutton(form, variable=self.autoUpdate) autoUpdateCheckbox.grid(column=3, row=1, sticky='w') autoBuyLbl = tk.Label(form, text='Auto Bid %:') autoBuyLbl.grid(column=2, row=2, sticky='e') autoBuyEntry = tk.Entry(form, width=4, textvariable=self.buy) autoBuyEntry.grid(column=3, row=2, sticky='w') autoSellLbl = tk.Label(form, text='Auto Sell %:') autoSellLbl.grid(column=2, row=3, sticky='e') autoSellEntry = tk.Entry(form, width=4, textvariable=self.sell) autoSellEntry.grid(column=3, row=3, sticky='w') autoBINLbl = tk.Label(form, text='Auto BIN %:') autoBINLbl.grid(column=2, row=4, sticky='e') autoBINEntry = tk.Entry(form, width=4, textvariable=self.bin) autoBINEntry.grid(column=3, row=4, sticky='w') relistAllLbl = tk.Label(form, text='Same Relist $:') relistAllLbl.grid(column=2, row=5, sticky='e') relistAllCheckbox = tk.Checkbutton(form, variable=self.relistAll) relistAllCheckbox.grid(column=3, row=5, sticky='w') self.bidbtn = tk.Button(form, text='Start Bidding', command=self.start) self.bidbtn.grid(column=0, row=6, columnspan=4, padx=5, pady=5) self.checkQueue() self.clearErrors()
def __init__(self, master, controller): Base.__init__(self, master, controller) self._watching = False self._errorCount = 0 self.q = mp.Queue() self.p = None options = tk.Frame(self, bg='#1d93ab') options.grid(column=0, row=0, sticky='ns') stats = tk.Frame(self, bg='#1d93ab') stats.grid(column=1, row=0, pady=50, sticky='ns') self.grid_rowconfigure(0, weight=1) self.grid_columnconfigure(0, weight=0) self.grid_columnconfigure(1, weight=1) back = tk.Button(options, bg='#1d93ab', text='Back to Player Search', command=self.show_playersearch) back.grid(column=0, row=0, sticky='we') self.card = tk.Label(options, bg='#1d93ab') self.card.grid(column=0, row=1) descLbl = tk.Label( stats, text= 'We are watching all of the trades for the next 20 minutes, and reporting below:', bg='#1d93ab', fg='#ffeb7e') descLbl.grid(column=0, row=0, columnspan=2) watchLbl = tk.Label(stats, text='Watched Trades:', bg='#1d93ab', fg='#ffeb7e') watchLbl.grid(column=0, row=1, sticky='e') self.numwatch = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.numwatch.grid(column=1, row=1) activeLbl = tk.Label(stats, text='Active Trades:', bg='#1d93ab', fg='#ffeb7e') activeLbl.grid(column=0, row=2, sticky='e') self.numactive = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.numactive.grid(column=1, row=2) bidLbl = tk.Label(stats, text='Trades with a Bid:', bg='#1d93ab', fg='#ffeb7e') bidLbl.grid(column=0, row=3, sticky='e') self.numbid = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.numbid.grid(column=1, row=3) lowLbl = tk.Label(stats, text='Lowest Bid:', bg='#1d93ab', fg='#ffeb7e') lowLbl.grid(column=0, row=4, sticky='e') self.low = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.low.grid(column=1, row=4) midLbl = tk.Label(stats, text='Median Bid:', bg='#1d93ab', fg='#ffeb7e') midLbl.grid(column=0, row=5, sticky='e') self.mid = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.mid.grid(column=1, row=5) avgLbl = tk.Label(stats, text='Average Bid:', bg='#1d93ab', fg='#ffeb7e') avgLbl.grid(column=0, row=6, sticky='e') self.avg = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.avg.grid(column=1, row=6) lowUnsoldLbl = tk.Label(stats, text='Lowest UNSOLD List Price:', bg='#1d93ab', fg='#ffeb7e') lowUnsoldLbl.grid(column=0, row=7, sticky='e') self.lowUnsold = tk.Label(stats, text='0', bg='#1d93ab', fg='#ffeb7e') self.lowUnsold.grid(column=1, row=7) self.checkQueue()
def __init__(self, master, controller): # init Base Base.__init__(self, master, controller) # Values self.controller = controller self.username = tk.StringVar() self.password = tk.StringVar() self.secret = tk.StringVar() self.code = tk.StringVar() self.platform = tk.StringVar() self.emulate = tk.StringVar() self.debug = tk.IntVar() self.data = [] self._keepalive = None # Search for settings try: with open(constants.LOGIN_FILE, "r") as f: self.data = json.load(f) if not isinstance(self.data, list): self.data = [self.data] self.username.set(self.data[0]["username"]) self.password.set(self.data[0]["password"]) self.secret.set(self.data[0]["secret"]) self.code.set(self.data[0]["code"]) self.platform.set(self.data[0]["platform"]) self.emulate.set(self.data[0]["emulate"]) except (FileNotFoundError, KeyError): self.platform.set("xbox") self.emulate.set("pc") mainframe = tk.Frame(self, bg="#1d93ab") mainframe.pack(expand=True) self.loginlbl = tk.Label( mainframe, text="\nWe need to collect your login information in order to connect to the FIFA servers. This information will be saved on your computer for future use.", anchor="w", justify="left", wraplength=500, fg="#fff", bg="#1d93ab", font=("KnulBold", 16), ) # self.loginlbl.grid(column=0, row=0) self.loginlbl.pack() loginfr = tk.Frame(mainframe) # loginfr.grid(column=0, row=1, sticky='ns') loginfr.pack() # init user input userlbl = tk.Label(loginfr, text="Email:", font=("KnulBold", 16, "bold")) userlbl.grid(column=0, row=1, sticky="e", padx=5, pady=5) userbox = tk.Entry(loginfr, textvariable=self.username) userbox.bind("<KeyRelease>", self.search) userbox.grid(column=1, row=1, sticky="w", padx=5, pady=5) passlbl = tk.Label(loginfr, text="Password:"******"KnulBold", 16, "bold")) passlbl.grid(column=0, row=2, sticky="e", padx=5, pady=5) passbox = tk.Entry(loginfr, textvariable=self.password, show="*") passbox.grid(column=1, row=2, sticky="w", padx=5, pady=5) secretlbl = tk.Label(loginfr, text="Secret Question:", font=("KnulBold", 16, "bold")) secretlbl.grid(column=0, row=3, sticky="e", padx=5, pady=5) secretbox = tk.Entry(loginfr, textvariable=self.secret, show="*") secretbox.grid(column=1, row=3, sticky="w", padx=5, pady=5) codelbl = tk.Label(loginfr, text="Access Code:", font=("KnulBold", 16, "bold")) codelbl.grid(column=0, row=4, sticky="e", padx=5, pady=5) codebox = tk.Entry(loginfr, textvariable=self.code) codebox.grid(column=1, row=4, sticky="w", padx=5, pady=5) platformlbl = tk.Label(loginfr, text="Platform:", font=("KnulBold", 16, "bold")) platformlbl.grid(column=0, row=5, sticky="e", padx=5, pady=5) platformsel = tk.OptionMenu(loginfr, self.platform, "pc", "xbox", "xbox360", "ps3", "ps4") platformsel.grid(column=1, row=5, sticky="w", padx=5, pady=5) emulatelbl = tk.Label(loginfr, text="Emulate:", font=("KnulBold", 16, "bold")) emulatelbl.grid(column=0, row=6, sticky="e", padx=5, pady=5) emulatesel = tk.OptionMenu(loginfr, self.emulate, "pc", "android", "iOS") emulatesel.grid(column=1, row=6, sticky="w", padx=5, pady=5) debugLbl = tk.Label(loginfr, text="Enable Debug:", font=("KnulBold", 16, "bold")) debugLbl.grid(column=0, row=7, sticky="e") autoUpdateEntry = tk.Checkbutton(loginfr, variable=self.debug) autoUpdateEntry.grid(column=1, row=7, sticky="w") loginbtn = tk.Button(loginfr, text="Login", command=self.login) loginbtn.grid(column=0, row=8, columnspan=2, padx=5, pady=5)