Best Python code snippet using fMBT_python
o_showUI.py
Source: o_showUI.py
...17 return QtGui.QApplication.translate(context, text, disambig, _encoding)18except AttributeError:19 def _translate(context, text, disambig):20 return QtGui.QApplication.translate(context, text, disambig)21class Ui_showWindow(object):22 def setupUi(self, showWindow):23 showWindow.setObjectName(_fromUtf8("showWindow"))24 showWindow.resize(506, 749)25 self.tabWidget = QtGui.QTabWidget(showWindow)26 self.tabWidget.setGeometry(QtCore.QRect(0, 10, 501, 731))27 self.tabWidget.setObjectName(_fromUtf8("tabWidget"))28 self.tab = QtGui.QWidget()29 self.tab.setObjectName(_fromUtf8("tab"))30 self.verticalLayout = QtGui.QVBoxLayout(self.tab)31 self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))32 self.uploadTable = QtGui.QTableWidget(self.tab)33 self.uploadTable.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.PointingHandCursor))34 self.uploadTable.setRowCount(0)35 self.uploadTable.setColumnCount(6)...
manager.py
Source: manager.py
1import os2import sys3import tkinter as tk4parentdir = os.path.dirname(os.path.dirname(__file__))5os.chdir(parentdir)6import mainmenu7import mode8import onoff9import forwardreverse10import singlecontinuous11import singlesettings12import continuoussettings13root = tk.Tk()14root.withdraw()15MAINMENU = 'mainmenu'16MODE = 'mode'17ONOFF = 'onoff'18FORWARDREVERSE = 'forwardreverse'19SINGLECONTINUOUS = 'singlecontinous'20SINGLESETTINGS = 'singlesettings'21CONTINUOUSSETTINGS = 'continuoussettings'22currentwindow = None23previouswindow = None24menudicts = {25 MAINMENU : mainmenu.create_mainmenu(root),26 MODE : mode.create_mode(root),27 ONOFF : onoff.create_onoff(root),28 FORWARDREVERSE : forwardreverse.create_forwardreverse(root),29 SINGLECONTINUOUS : singlecontinuous.create_singlecontinuous(root),30 SINGLESETTINGS : singlesettings.create_singlesettings(root),31 CONTINUOUSSETTINGS : continuoussettings.create_continuoussettings(root)32}33def settingsbuttonclicked(event):34 showwindow(MODE)35 pass36def autobuttonclicked(event):37 showwindow(FORWARDREVERSE)38def forwardbuttonclicked(event):39 showwindow(SINGLECONTINUOUS)40def reversebuttonclicked(event):41 showwindow(SINGLECONTINUOUS)42def operatorbuttonclicked(event):43 showwindow(ONOFF)44def onoffbackbuttonclicked(event):45 showwindow(MAINMENU)46def modebackbuttonclicked(event):47 showwindow(MAINMENU)48def forwardreversebackbuttonclicked(event):49 showwindow(MODE)50def singlecontinuousbackbuttonclicked(event):51 showwindow(FORWARDREVERSE)52def singlebuttonclicked(event):53 showwindow(SINGLESETTINGS)54 pass55def continuousbuttonclicked(event):56 showwindow(CONTINUOUSSETTINGS)57 pass58def singlesettingsbackbuttonclicked(event):59 showwindow(SINGLECONTINUOUS)60def singlehomebuttonclicked(event):61 showwindow(MAINMENU)62def singlesavebuttonclicked(event):63 # showwindow(SINGLECONTINUOUS)64 pass65def continuoussettingsbackbuttonclicked(event):66 showwindow(SINGLECONTINUOUS)67def continuoushomebuttonclicked(event):68 showwindow(MAINMENU)69def continuoussavebuttonclicked(event):70 # showwindow(SINGLECONTINUOUS)71 pass72menudicts[MAINMENU][1].settingsbutton.bind('<Button-1>', settingsbuttonclicked)73menudicts[MAINMENU][1].operatorbutton.bind('<Button-1>', operatorbuttonclicked)74menudicts[ONOFF][1].onoffbackbutton.bind('<Button-1>', onoffbackbuttonclicked)75menudicts[MODE][1].modebackbutton.bind('<Button-1>', modebackbuttonclicked)76menudicts[MODE][1].autobutton.bind('<Button-1>', autobuttonclicked)77menudicts[FORWARDREVERSE][1].forwardreversebackbutton.bind('<Button-1>', forwardreversebackbuttonclicked)78menudicts[FORWARDREVERSE][1].forwardbutton.bind('<Button-1>', forwardbuttonclicked)79menudicts[FORWARDREVERSE][1].reversebutton.bind('<Button-1>', reversebuttonclicked)80menudicts[SINGLECONTINUOUS][1].singlecontinuousbackbutton.bind('<Button-1>', singlecontinuousbackbuttonclicked)81menudicts[SINGLECONTINUOUS][1].singlebutton.bind('<Button-1>', singlebuttonclicked)82menudicts[SINGLECONTINUOUS][1].continuousbutton.bind('<Button-1>', continuousbuttonclicked)83menudicts[SINGLESETTINGS][1].singlesettingsbackbutton.bind('<Button-1>', singlesettingsbackbuttonclicked)84menudicts[SINGLESETTINGS][1].homebutton.bind('<Button-1>', singlehomebuttonclicked)85menudicts[SINGLESETTINGS][1].savebutton.bind('<Button-1>', singlesavebuttonclicked)86menudicts[CONTINUOUSSETTINGS][1].continuoussettingsbackbutton.bind('<Button-1>', continuoussettingsbackbuttonclicked)87menudicts[CONTINUOUSSETTINGS][1].homebutton.bind('<Button-1>', continuoushomebuttonclicked)88menudicts[CONTINUOUSSETTINGS][1].savebutton.bind('<Button-1>', continuoussavebuttonclicked)89numwindows = len(menudicts)90def hideallwindows():91 allwindows = menudicts.values()92 for window in allwindows:93 window[0].grab_release()94 window[0].withdraw()95 pass96def hidewindow(windowname):97 menudicts[windowname][0].grab_release()98 menudicts[windowname][0].withdraw()99def showwindow(windowname):100 global currentwindow, previouswindow101 previouswindow = currentwindow102 currentwindow = windowname103 if previouswindow is not None:104 hidewindow(previouswindow)105 menudicts[currentwindow][0].deiconify()106 menudicts[currentwindow][0].mainloop()107 pass108hideallwindows()109showwindow(MAINMENU)110root.mainloop()...
neuroforge-03-binaryImages.py
Source: neuroforge-03-binaryImages.py
...12cv.MoveWindow('window', 100, 100)13# create our image from a file14image = cv.LoadImage('picture.png', cv.CV_LOAD_IMAGE_COLOR)15# helper function to show our image16def showWindow(message):17 print message18 print " [press any key to continue]"19 cv.ShowImage('window', image)20 cv.WaitKey(10000)21showWindow("showing original image")22# helper function to load greyscale version of our image23def loadGreyscale():24 return cv.LoadImage('picture.png', cv.CV_LOAD_IMAGE_GRAYSCALE)25image = loadGreyscale()26showWindow("showing greyscale")27# smooth the image28image = loadGreyscale()29cv.Smooth(image, image, cv.CV_MEDIAN)30showWindow("smoothed image")31# histogram32image = loadGreyscale()33cv.EqualizeHist(image, image)34showWindow("histogram")35# binary threshold36image = loadGreyscale()37threshold = 10038color = 25539cv.Threshold(image, image, threshold, color, cv.CV_THRESH_BINARY)40showWindow("binary threshold")41# Otsu threshold42image = loadGreyscale()43cv.Threshold(image, image, threshold, color, cv.CV_THRESH_OTSU)44showWindow("Otsu threshold")45# Dilation46image = loadGreyscale()47element_shape = cv.CV_SHAPE_RECT48pos = 149element = cv.CreateStructuringElementEx(pos*2+1, pos*2+1, pos, pos, element_shape)50cv.Dilate(image, image, element, 2)51showWindow("Dilate")52# Erosion53image = loadGreyscale()54cv.Erode(image, image, element, 2)55showWindow("Erode")56# Morphology57image = loadGreyscale()58cv.MorphologyEx(image, image, image, element, cv.CV_MOP_CLOSE, 2)59showWindow("Morphology")60# Laplace61image = loadGreyscale()62dst_16s2 = cv.CreateImage(cv.GetSize(image), cv.IPL_DEPTH_16S, 1)63cv.Laplace(image, dst_16s2)64cv.Convert(dst_16s2, image)...
Check out the latest blogs from LambdaTest on this topic:
Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!