本文整理汇总了Python中Tkinter.Tk.wm_withdraw方法的典型用法代码示例。如果您正苦于以下问题:Python Tk.wm_withdraw方法的具体用法?Python Tk.wm_withdraw怎么用?Python Tk.wm_withdraw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter.Tk
的用法示例。
在下文中一共展示了Tk.wm_withdraw方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wm_withdraw [as 别名]
def main():
#this is the main part of the script. You can tell it is the main because it is called main.
Tk().withdraw() #Not a full GUI
titlePrep = "Choose your .iri file! the .csv"
messagePrep = "This will add this IRI file to a new RSP file. The one ending in .CSV!!!"
iriPath = askopenfilename(title = titlePrep, message = messagePrep)#show an open dialog box - This is for the IRI file.
titlePrep2 = "Choose your RSP file that is associated with the chosen IRI file. It should end in .RSP"
messagePrep2 = "This will create a new rsp file with the info from the IRI file."
rspPath = askopenfilename(title = titlePrep2, message = messagePrep2)#show an open dialog box - This is for the RSP file. The RSP and IRI do not have exactly the same name, otherwise I would have made this a batch process.
#Make a new rep_new file. rspbasename[1] should be changed to 'iri' but I did not know that until I completed everything.
rspbasename = os.path.basename(rspPath).rsplit('.',1)
newRSPpath = os.path.join(os.path.dirname(rspPath), ".".join([rspbasename[0]+"_new", rspbasename[1]]))
#open the iri and rsp as 'r' read only. open the new one as 'w' write.
iriFile = open(iriPath, 'r')
rspFile = open(rspPath, 'r')
newRSPFile = open(newRSPpath, 'w')
# Put the iri file into a list. Probably not the most efficient way to do this, but I okay wit dat.
iriList = list()
for thisline in iriFile:
thislinesplit = thisline.split(',')
if thislinesplit[1] != thislinesplit[2]: #Column one and two in the iri file are the distances from the start and stop of the iri summary. For some reason, some of them had 0 distance - 1 and 2 were the same numbers instead of being 1/1000th different.
iriList.append(thislinesplit)
iriFile.close()
#Write each line from the old rsp file to the newrspfile.
n = 0
for line in rspFile:
lineparts = line.split(',')
if lineparts[0] == '5406': #lineparts[0] is the first item in the line.
try:
newRSPFile.write(', '.join(iriList[n]) + '\r') #Write the iri list to the new rsp file. Join the list together and separated by commas. I added the space for prettyness.
except IndexError:
pass #Go on if there is an error. This will make is so the new rsp file skips over the rest of the 5406 lines.
n = n + 1
else:
newRSPFile.write(line)
rspFile.close()
newRSPFile.close()
#Tell the user that the script is complete.
window = Tk()
window.wm_withdraw()
tkMessageBox.showinfo(title="The End", message = "The new RSP file is complete.")
示例2: show_message
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wm_withdraw [as 别名]
def show_message(message, title="message"):
window = Tk()
window.wm_withdraw()
tkMessageBox.showinfo(title=title, message=message, parent=window)
示例3: speedValidator
# 需要导入模块: from Tkinter import Tk [as 别名]
# 或者: from Tkinter.Tk import wm_withdraw [as 别名]
#.........这里部分代码省略.........
#stdev:
stdSpeedList = []
for num in speedList:
stdSpeedList.append(float(num))
stdev = numpy.std(stdSpeedList)
stdevList.append(stdev)
#get the tenth of a route list
listoftenthavgspeedlist.append(getlistaverageforten(speedList, lengthList)) #This will be a list of the averages of a tenth of the route.
#Distance list
xdistanceAxis_notrounded = []
for i in range(0,int(lengthList)):
xdistanceAxis_notrounded.append(i*interval)
xmax = i*interval
xdistanceAxis = []
for number in xdistanceAxis_notrounded:
xdistanceAxis.append(round(number, 4))
#Graph:
plt.plot(xdistanceAxis, speedList, label = 'route '+ str(cnt)) #Don't want the entire route's name in the legend.
plt.ylabel("Speed (mph)")
plt.xlabel("Distance (miles )")
ymax = float(maximumspeed)+int(5)
ymin = float(minimumspeed)-int(10)
plt.axis([0, xmax, ymin, ymax])
legend(loc=4, ncol=2, mode="expand", borderaxespad=0, prop={'size':10} )
plt.title(os.path.basename(fileDir) + " Speed Validation")
#Count for the graph legend
cnt = cnt + 1
graphPath = fileDir + '/' + os.path.basename(fileDir) + "_Graph.pdf"
plt.savefig(graphPath)
#total routes std dev.
totalstdev = numpy.mean(stdevList)
if totalstdev >= 0.5:
passfail = "Fail"
else:
passfail = "Pass"
#total maximum/minimum
totalMax = max(MaximumList)
totalMin = min(MinimumList)
#Total average of all the routes.
totalspeed = 0
for numb in AverageList:
totalspeed = numb + totalspeed
totalcount = len(AverageList)
totalaverage = float(totalspeed)/totalcount
totalaverage = round(totalaverage,1)
#the rounded values for the averagelist. This is not used really.
roundAvgList = []
for avgnum in AverageList:
roundAvgList.append(round(avgnum,1))
#WAYYYY TOOO many variables put into this function. Probably not the best programming technique.
textFilePath = createthetextfile(fileDir, listoftenthavgspeedlist, MaximumList, MinimumList, rspfilepaths, stdevList, roundAvgList, totalstdev, totalMax, totalMin, totalaverage, passfail)
#________________________________________________________________________________________________________________________________
MainPDFPath = fileDir + "/" + os.path.basename(fileDir) + "_Validation.pdf"
#Read the data from the text file
MainValidation = open(textFilePath, 'r')
Data = []
for line in MainValidation:
Data.append(line)
MainValidation.close()
elements = []
styles = getSampleStyleSheet()
doc = SimpleDocTemplate(MainPDFPath)
# Create two 'Paragraph' Flowables and add them to our 'elements'
count = 1
for line in Data:
if count == 1: #This is the title line.
elements.append(Paragraph('<font size = 18>' + line + '</font', styles['Heading1']))
elements.append(Paragraph('\n', styles['Heading1']))
elif count == 7: #This is the line at the end of the validation summary.
elements.append(Paragraph('<br/>', styles['Heading1']))
elements.append(Paragraph('<br/>', styles['Heading1']))
elements.append(Paragraph('<font size = 14>' + line + '</font', styles['Normal']))
elements.append(Paragraph('<br/>', styles['Heading1']))
elements.append(Paragraph('<br/>', styles['Heading1']))
elements.append(Paragraph('<br/>', styles['Heading1']))
else:
elements.append(Paragraph('<font size = 10>' + line + '</font', styles['Normal']))
count = count + 1
# Write the document to disk
doc.build(elements)
#________________________________________________________________________________________________________________________________
#remove that text file and then display an ending message.
os.remove(textFilePath)
window = Tk()
window.wm_withdraw()
tkMessageBox.showinfo(title="This is the End", message = "Work Complete.")