How to use swipeText method in fMBT

Best Python code snippet using fMBT_python

VMgui.py

Source:VMgui.py Github

copy

Full Screen

1import wx, sys, sched, time2#import serial3from time import sleep4from VMUser import VMUser5class VMgui(wx.Frame):6 def __init__(self, *args, **kw):7 super(VMgui, self).__init__(*args, **kw)8 self.initUI()9 rawCardData = ""10 user = None11 def initUI(self):12 #self.ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=0)13 windowH = 48014 windowW = 80015 windowSize = wx.Size(windowW,windowH)16 largeFont = 5017 smallFont = 3018 self.swipeSizer = wx.BoxSizer(wx.VERTICAL)19 self.swipeWin = wx.Frame(None, -1, 'swipeWindow')20 self.swipeTextVal = "Please Swipe ID"21 self.swipeText = wx.StaticText(self.swipeWin, -1, self.swipeTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)22 self.swipeText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))23 self.swipeTextCtrl = wx.TextCtrl(self.swipeWin, -1, size=(1, 1))24 self.swipeSizer.Add(self.swipeText, 1, wx.ALIGN_CENTER_VERTICAL)25 self.swipeWin.SetWindowStyleFlag(wx.BORDER_NONE)26 self.swipeWin.SetSize(windowSize)27 self.swipeWin.CenterOnScreen()28 self.swipeWin.SetSizer(self.swipeSizer)29 self.swipeWin.SetBackgroundColour(wx.Colour(225,80,0))30 31 self.itemWin = wx.Frame(None, -1, 'itemWindow')32 self.itemSizer = wx.BoxSizer(wx.VERTICAL)33 self.itemTextVal = "Select an item:"34 self.itemText = wx.StaticText(self.itemWin, -1, self.itemTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)35 self.itemTextCtrl = wx.TextCtrl(self.itemWin)36 self.itemText.SetFont(wx.Font(smallFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))37 self.itemTextCtrl.SetFont(wx.Font(smallFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))38 self.itemDispTextVal = " "39 self.itemDispText = wx.StaticText(self.itemWin, -1, self.itemDispTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)40 self.itemDispText.SetFont(wx.Font(smallFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))41 self.welcomeTextVal = "Welcome "42 self.welcomeText = wx.StaticText(self.itemWin, -1, self.welcomeTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)43 self.welcomeText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))44 self.itemSizer.Add(self.welcomeText, 1, wx.ALIGN_CENTER)45 self.itemSizer.Add(self.itemText, 1, wx.ALIGN_CENTER)46 self.itemSizer.Add(self.itemTextCtrl, 1, wx.ALIGN_CENTER)47 self.itemSizer.Add(self.itemDispText, 1, wx.ALIGN_CENTER)48 self.itemWin.SetWindowStyleFlag(wx.BORDER_NONE)49 self.itemWin.SetSize(windowSize)50 self.itemWin.CenterOnScreen()51 self.itemWin.SetSizer(self.itemSizer)52 self.itemWin.SetBackgroundColour(wx.Colour(255, 80, 0))53 self.adminWin = wx.Frame(None, -1, 'adminWindow')54 self.adminSizer = wx.BoxSizer(wx.VERTICAL)55 self.adminTextVal = "Select an option: \n0. QUIT\n1. add/remove Team\n2. add/remove member\n3. add/remove an admin\n4. stock options\n"56 self.adminText = wx.StaticText(self.adminWin, -1, self.adminTextVal, (0, 0), wx.DefaultSize)57 self.adminTextCtrl = wx.TextCtrl(self.adminWin)58 self.adminText.SetFont(wx.Font(50, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))59 self.adminTextCtrl.SetFont(wx.Font(50, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))60 self.adminDispText = wx.StaticText(self.adminWin, -1)61 self.adminDispText.SetFont(wx.Font(18, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))62 self.adminSizer.Add(self.adminText, 2, wx.ALIGN_LEFT, wx.ALIGN_TOP)63 self.adminSizer.Add(self.adminTextCtrl, 2, wx.ALIGN_RIGHT)64 self.adminSizer.Add(self.adminDispText, 1, wx.ALIGN_RIGHT)65 self.adminWin.SetWindowStyleFlag(wx.BORDER_NONE)66 self.adminWin.SetSize(windowSize)67 self.adminWin.CenterOnScreen()68 self.adminWin.SetSizer(self.adminSizer)69 self.adminWin.SetBackgroundColour(wx.Colour(255, 80, 0))70 self.dispenseSizer = wx.BoxSizer(wx.VERTICAL)71 self.dispenseWin = wx.Frame(None, -1, 'dispenseWindow')72 self.dispenseTextVal = "Dispensing: "73 self.dispenseText = wx.StaticText(self.dispenseWin, -1, self.dispenseTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)74 self.dispenseText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))75 self.dispenseWin.SetWindowStyleFlag(wx.BORDER_NONE)76 self.dispenseWin.SetSize(windowSize)77 self.dispenseWin.CenterOnScreen()78 self.dispenseWin.SetSizer(self.dispenseSizer)79 self.dispenseWin.SetBackgroundColour(wx.Colour(255, 80, 0))80 self.dispenseSizer.Add(self.dispenseText, 1, wx.ALIGN_CENTER)81 82 '''self.confirmSizer = wx.BoxSizer(wx.VERTICAL)83 self.confirmWin = wx.Frame(None, -1, 'confirmWindow')84 self.confirmTextVal = "Are"85 self.confirmText = wx.StaticText(self.confirmWin, -1, self.confirmTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)86 self.confirmText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))87 self.confirmTextCtrl = wx.TextCtrl(self.confirmWin, -1, size=(1, 1))88 self.confirmSizer.Add(self.confirmText, 1, wx.ALIGN_CENTER_VERTICAL)89 90 #self.confirmWin.SetWindowStyleFlag()91 self.confirmWin.SetSize(windowSize)92 self.confirmWin.CenterOnScreen()93 self.confirmWin.SetSizer(self.dispenseSizer)94 self.confirmWin.SetBackgroundColour(wx.Colour(255, 80, 0))95 self.confirmSizer.Add(self.dispenseText, 1, wx.ALIGN_CENTER)'''96 97 98 99 self.swipe1Sizer = wx.BoxSizer(wx.VERTICAL)100 self.swipe1Win = wx.Frame(None, -1, 'swipeWindow')101 self.swipe1TextVal = "My Text"102 self.swipe1Text = wx.StaticText(self.swipe1Win, -1, self.swipe1TextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)103 self.swipe1Text.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))104 self.swipe1TextCtrl = wx.TextCtrl(self.swipe1Win, -1, size=(1, 1))105 self.swipe1Sizer.Add(self.swipeText, 1, wx.ALIGN_CENTER_VERTICAL)106 self.swipe1Win.SetWindowStyleFlag(wx.BORDER_NONE)107 self.swipe1Win.SetSize(windowSize)108 self.swipe1Win.CenterOnScreen()109 self.swipe1Win.SetSizer(self.swipe1Sizer)110 self.swipe1Win.SetBackgroundColour(wx.Colour(225,80,0))111 112 def promptSwipeWindow(self):113 self.itemTextCtrl.Remove(0, self.itemTextCtrl.GetLineLength(0))114 self.newUser = None115 self.swipeWin.Show()116 self.swipeTextCtrl.SetFocus()117 self.itemWin.Hide()118 #binding the entering of text with OnSwipe Function119 self.rawCardData = ""120 self.swipeTextCtrl.Bind(wx.EVT_CHAR, self.swipedCard)121 122 def swipedCard(self, event):123 key = event.GetRawKeyCode()124 print("swipe" + str(key))125 #if key is a valid character keep it, other wise126 if key < 256 and key > 13 :127 self.rawCardData += str(chr(key))128 else :129 print self.rawCardData + "\n"130 self.user = VMUser(self.rawCardData)131 self.rawCardData = ""132 #if name is valid then we set it to lower case133 if(len(self.user.name) > 1):134 self.user.name = self.user.name[0] + self.user.name[1::].lower()135 print("User Data" + self.user.toString())136 if(self.user.verified):137 self.promptSelection()138 def promptSelection(self):139 self.welcomeText.SetLabel(self.welcomeTextVal + self.user.name + "\nTeam Balance: " + str(self.user.balance) + "\nItem: ?? Cost: ??")140 print "Balance: " + str(self.user.balance)141 self.itemWin.Show()142 self.swipeWin.Hide()143 self.itemTextCtrl.Bind(wx.EVT_CHAR, self.choiceInput)144 self.itemTextCtrl.SetFocus()145 146 def choiceInput(self, event):147 key = event.GetRawKeyCode()148 if key == 13:149 if self.itemTextCtrl.GetLineLength(0) > 0:150 print self.itemTextCtrl.GetLineText(0)151 self.dispense(self.user.getItem(self.itemTextCtrl.GetLineText(0)))152 #self.verifySelection(self.user.getItem(self.itemTextCtrl.GetLineText(0)))153 elif key == 46:154 if self.itemTextCtrl.GetLastPosition() == 0:155 self.promptSwipeWindow()156 self.itemTextCtrl.Remove(self.itemTextCtrl.GetLastPosition()-1, self.itemTextCtrl.GetLastPosition())157 elif key > 47 and key < 58:158 if self.itemTextCtrl.GetLastPosition() < 2:159 self.itemTextCtrl.AppendText(chr(key))160 currItem = self.itemTextCtrl.GetLineText(0)161 162 if self.itemTextCtrl.GetLastPosition() == 2:163 item = self.user.getItem(self.itemTextCtrl.GetLineText(0))164 self.welcomeText.SetLabel(self.welcomeTextVal + self.user.name + "\nTeam Balance: " + str(self.user.balance) + "\nCost: " + str(item[1]))165 '''if len(currItem) == 2:166 self.itemDispText.SetLabel("Item: " + str(self.itemList[currItem].name) +"\nCost: " + str(self.itemList[currItem].cost) + " Qty: " + str(self.itemList[currItem].qty))167 wx.SafeYield()168 self.itemTextCtrl.SetFocus()'''169 170 def verifySelection(self, item):171 self.swipe1Win.Show()172 self.itemWin.Hide()173 #self.itemWin.Hide()174 #self.swipeTextCtrl.SetFocus()175 self.dispense(item)176 if item == None:177 #self.confirmTextSetLabel("Your Item Was Not Found")178 #set text to failure to find time179 print "ITEM NOT FOUND"180 else:181 print ", ".join(map(str, item))182 #self.confirmText.SetLabel("Are")183 #ask user -> "Are you sure you want a ITEMNAME?"184 #0 - no 185 #1 - yes186 #press any other button to cancel187 #either go back tp main screen or go the dispense screen188 #self.dispense(item)189 190 def dispense(self, item): 191 itemName = item[0]192 itemLocation = item[2]193 self.dispenseText.SetLabel(self.dispenseTextVal + str(itemName))194 wx.Yield()195 self.itemWin.Hide()196 wx.Yield()197 self.dispenseWin.Show()198 199 wx.Yield()200 #self.ser.write("*" + itemLocation[0] + "*" + itemLocation[1] + "*")201 self.user.dispenseItem(item)202 sleep(3)203 self.dispenseWin.Hide()...

Full Screen

Full Screen

vendingMachine.py

Source:vendingMachine.py Github

copy

Full Screen

1import wx2import time3import getpass4import sys5from collections import namedtuple6#import serial7import dbAccess8class VendingMachine(wx.Frame):9 def __init__(self, *args, **kw):10 super(VendingMachine, self).__init__(*args, **kw)11 self.initUI()12 self.cardString = ""13 self.keyDict = {384:'0', 382:'1', 379:'2', 381:'3', 376:'4', 383:'5', 378:'6', 375:'7', 377:'8', 380:'9'}14 #self.db = dbAccess()15 16 def initUI(self):17 #self.ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600, timeout=0)18 windowH = 23419 windowW = 43820 windowSize = wx.Size(windowW,windowH)21 largeFont = 3222 smallFont = 2423 self.swipeSizer = wx.BoxSizer(wx.VERTICAL)24 self.swipeWin = wx.Frame(None, -1, 'swipeWindow')25 self.swipeTextVal = "Please Swipe ID"26 self.swipeText = wx.StaticText(self.swipeWin, -1, self.swipeTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)27 self.swipeText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))28 self.swipeTextCtrl = wx.TextCtrl(self.swipeWin, -1, size=(1, 1))29 self.itemWin = wx.Frame(None, -1, 'itemWindow')30 self.itemSizer = wx.BoxSizer(wx.VERTICAL)31 self.itemTextVal = "Select an item:"32 self.itemText = wx.StaticText(self.itemWin, -1, self.itemTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)33 self.itemTextCtrl = wx.TextCtrl(self.itemWin)34 self.itemText.SetFont(wx.Font(smallFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))35 self.itemTextCtrl.SetFont(wx.Font(smallFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))36 self.itemDispTextVal = " "37 self.itemDispText = wx.StaticText(self.itemWin, -1, self.itemDispTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)38 self.itemDispText.SetFont(wx.Font(18, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))39 self.welcomeTextVal = "Welcome "40 self.welcomeText = wx.StaticText(self.itemWin, -1, self.welcomeTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)41 self.welcomeText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))42 self.dispenseSizer = wx.BoxSizer(wx.VERTICAL)43 self.dispenseWin = wx.Frame(None, -1, 'dispenseWindow')44 self.dispenseTextVal = "Dispensing: "45 self.dispenseText = wx.StaticText(self.dispenseWin, -1, self.dispenseTextVal, wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)46 self.dispenseText.SetFont(wx.Font(largeFont, wx.FONTFAMILY_MODERN, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))47 self.swipeSizer.Add(self.swipeText, 1, wx.ALIGN_CENTER_VERTICAL)48 self.swipeWin.SetWindowStyleFlag(wx.BORDER_NONE)49 self.swipeWin.SetSize(windowSize)50 self.swipeWin.CenterOnScreen()51 self.swipeWin.SetSizer(self.swipeSizer)52 self.swipeWin.SetBackgroundColour(wx.Colour(225,80,0))53 54 self.itemSizer.Add(self.welcomeText, 1, wx.ALIGN_CENTER)55 self.itemSizer.Add(self.itemText, 1, wx.ALIGN_CENTER)56 self.itemSizer.Add(self.itemTextCtrl, 1, wx.ALIGN_CENTER)57 self.itemSizer.Add(self.itemDispText, 1, wx.ALIGN_CENTER)58 self.itemWin.SetWindowStyleFlag(wx.BORDER_NONE)59 self.itemWin.SetSize(windowSize)60 self.itemWin.CenterOnScreen()61 self.itemWin.SetSizer(self.itemSizer)62 self.itemWin.SetBackgroundColour(wx.Colour(255, 80, 0))63 self.dispenseWin.SetWindowStyleFlag(wx.BORDER_NONE)64 self.dispenseWin.SetSize(windowSize)65 self.dispenseWin.CenterOnScreen()66 self.dispenseWin.SetSizer(self.dispenseSizer)67 self.dispenseWin.SetBackgroundColour(wx.Colour(255, 80, 0))68 self.dispenseSizer.Add(self.dispenseText, 1, wx.ALIGN_CENTER)69 self.initItems()70 self.User = namedtuple('User', ['name', 'surname', 'id'], verbose=False)71 # initItems72 # This function generates a dictionary describing the items available in the vending machine73 # Dictionary index is slot number74 def initItems(self):75 Item = namedtuple('Item', ['name','qty','cost', 'slot'])76 infile = open('inventory.txt', 'r')77 self.itemList = {}78 for i in range(10):79 for j in range(5):80 it = ["Item" + str(i) + str(j), 0, 0, str(i) + str(j)]81 self.itemList[str(i) + str(j)] = Item._make(it)82 for line in infile:83 wordlist = line.split()84 it = [wordlist[0], 0, wordlist[1], wordlist[2]]85 self.itemList[wordlist[2]] = Item._make(it)86 infile.close()87 88 # updateItems89 # This function updates the item list with the new item quanitities 90 #def updateItems(self, slot)91 # self.itemList #this is the item dictionary92 def promptSwipe(self):93 self.User.id = ""94 self.User.name = ""95 self.User.surname = ""96 self.swipeWin.Show()97 self.swipeTextCtrl.SetFocus()98 self.itemWin.Hide()99 self.swipeTextCtrl.Bind(wx.EVT_CHAR, self.OnSwipe)100 def promptItem(self):101 self.welcomeText.SetLabel(self.welcomeTextVal + self.User.name)102 self.itemWin.Show()103 self.swipeWin.Hide()104 self.itemTextCtrl.Bind(wx.EVT_CHAR, self.OnEntry)105 self.itemTextCtrl.SetFocus()106 def readCard(self):107 swipe = self.cardString108 track1begin = 0109 track1end = 0110 track2begin = 0111 track2end = 0112 track3begin = 0113 track3end = 0114 for ch in range(len(swipe)):115 if swipe[ch] == '%':116 track1begin = ch + 1117 elif swipe[ch] == ';':118 track2begin = ch + 1119 elif swipe[ch] == '+':120 track3begin = ch + 1121 if swipe[ch] == '?':122 if track1end == 0 and track1begin != 0:123 track1end = ch124 elif track2end == 0 and track2begin != 0:125 track2end = ch126 elif track3end == 0 and track3begin != 0:127 track3end = ch128 129 track1 = swipe[track1begin:track1end]130 track2 = swipe[track2begin:track2end]131 track3 = swipe[track3begin:track3end]132 if not (track1 or track2 or track3):133 print("Read Error")134 return135 _userid = ""136 _name = ""137 _surname = ""138 #check card edition139 if (not track3) or len(track3) < 8 :140 _userid = track2[len(track2)-8:len(track2)+2]141 else:142 list = track3.split("=")143 _userid = list[0]144 _surname = list[1]145 _name = list[2]146 check = track2[len(track2)-8:len(track2)+2]147 #double check id number148 if _userid != check:149 print("Card Error")150 return151 #Uncomment for Debug info152 #print("Track 1: " + track1 + "\n")153 #print("Track 2: " + track2 + "\n")154 #print("Track 3: " + track3 + "\n")155 #print("Name : " + _name + " " + _surname)156 #print("UserID : " + _userid)157 158 self.User.name = _name159 self.User.surname = _surname160 self.User.id = _userid161 def OnSwipe(self, event):162 key = event.GetRawKeyCode()163 164 if key < 256 :165 self.cardString += str(chr(key))166 else :167 #print self.cardString + "\n"168 self.readCard()169 self.cardString = ""170 if(len(self.User.name) > 1):171 self.User.name = self.User.name[0] + self.User.name[1::].lower()172 if(len(self.User.id) is 8):173 self.promptItem()174 #event.Skip()175 176 def OnEntry(self, event):177 178 key = event.GetUnicodeKey()179 print str(key)180 if(key == 370):181 if self.itemTextCtrl.GetLineLength(0) == 2:182 itemNum = self.itemTextCtrl.GetLineText(0)183 try:184 itemNum = str(itemNum)185 self.itemTextCtrl.Remove(0, self.itemTextCtrl.GetLastPosition())186 wx.Yield()187 self.dispense(itemNum)188 self.promptSwipe()189 except TypeError:190 print("Type Error")191 except Exception as e:192 print(e)193 elif key == 385:194 self.itemTextCtrl.Remove(self.itemTextCtrl.GetLastPosition()-1, self.itemTextCtrl.GetLastPosition())195 elif key in self.keyDict:196 self.itemTextCtrl.AppendText(self.keyDict[key])197 currItem = self.itemTextCtrl.GetLineText(0)198 if len(currItem) == 2:199 try:200 self.itemDispText.SetLabel("Item: " + str(self.itemList[currItem].name) +"\nCost: " + str(self.itemList[currItem].cost) + " Qty: " + str(self.itemList[currItem].qty))201 wx.SafeYield()202 self.itemTextCtrl.SetFocus()203 except KeyError as e:204 print "Key out of bounds\n"205 if self.itemTextCtrl.GetLineLength(0) < 2:206 self.itemDispText.SetLabel("")207 #event.Skip()208 209 # getBalanceByID210 # This function uses the user id to look up the balance available to the user211 #def getBalanceByID(self, id)212 # self.id #this is the id number213 # setBalanceByID214 # This function uses the user id to update the balance available to the user 215 #def setBalanceByID(self, id, balance)216 # self.id #this is the id number217 def dispense(self, itemNum):218 self.dispenseText.SetLabel(self.dispenseTextVal + str(itemNum))219 wx.Yield()220 self.itemWin.Hide()221 wx.Yield()222 self.dispenseWin.Show()223 224 wx.Yield()225 #self.ser.write("*" + itemNum[0] + "*" + itemNum[1] + "*")226 self.Update()227 wx.Yield()228 while True:229 wx.Yield()230 x = self.ser.read(6)231 if len(x) != 0:232 break233 234 wx.Yield()235 self.dispenseWin.Hide()236 wx.Yield()237 238 self.itemDispText.SetLabel("")239def main():240 app = wx.App()241 vm = VendingMachine(None)242 vm.promptSwipe()243 244 app.MainLoop()245if __name__ == '__main__':246 main()...

Full Screen

Full Screen

Swap.py

Source:Swap.py Github

copy

Full Screen

1def SwipeText():2 3 F1 = input("Enter file 1 name: ")4 F2 = input("Enter file 2 name: ")56 data_a = open(F1, 'r')7 data_b = open(F2, 'r')89 print(data_a)10 print(data_b)1112 Swap1 = open(F1, 'w')13 Swap2 = open(F2, 'w')1415 Swap1.write(data_b)16 Swap2.write(data_a)17 18 print(Swap1.read())19 print(Swap2.read())20 ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fMBT automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful