python-3.5

Python Tkinter Menu creation not working

自作多情 提交于 2020-01-06 23:43:26
问题 I am new to programming and am trying to create a menu in Python with the Tkinter package. But whenever I run the script in IDLE, all that is displayed is the top level (root) window. Here is my script: from tkinter import * from tkinter import ttk root.option_add('*tearOff', False) menubar1 = Menu(root) root.configure(menu = menubar1) file = Menu(menubar1) edit = Menu(menubar1) help_ = Menu(menubar1) tools = Menu(menubar1) other = Menu(menubar1) menubar1.add_cascade(menu = file, label =

Why tkinter.filedialog.askdirectory isn't returning the full path (with the selected dirname)?

落花浮王杯 提交于 2020-01-05 11:12:34
问题 I'm trying to get the full path of a directory selected via tkinter.filedialog.askdirectory, but it only returns the path of the root folder, for example, selection the folder /root will return only '/', this seems strange, how to get it return the full path in python3.5? import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() dirname = filedialog.askdirectory(parent=root,initialdir="/",title='Please select a directory') if len(dirname ) > 0: print("You chose %s" %

Why tkinter.filedialog.askdirectory isn't returning the full path (with the selected dirname)?

*爱你&永不变心* 提交于 2020-01-05 11:12:33
问题 I'm trying to get the full path of a directory selected via tkinter.filedialog.askdirectory, but it only returns the path of the root folder, for example, selection the folder /root will return only '/', this seems strange, how to get it return the full path in python3.5? import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() dirname = filedialog.askdirectory(parent=root,initialdir="/",title='Please select a directory') if len(dirname ) > 0: print("You chose %s" %

Why tkinter.filedialog.askdirectory isn't returning the full path (with the selected dirname)?

房东的猫 提交于 2020-01-05 11:10:05
问题 I'm trying to get the full path of a directory selected via tkinter.filedialog.askdirectory, but it only returns the path of the root folder, for example, selection the folder /root will return only '/', this seems strange, how to get it return the full path in python3.5? import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() dirname = filedialog.askdirectory(parent=root,initialdir="/",title='Please select a directory') if len(dirname ) > 0: print("You chose %s" %

Python download images with alernating variables

邮差的信 提交于 2020-01-05 05:36:22
问题 I was trying to download images with url's that change but got an error. url_image="http://www.joblo.com/timthumb.php?src=/posters/images/full/"+str(title_2)+"-poster1.jpg&h=333&w=225" user_agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64)' headers = {'User-Agent': user_agent} req = urllib.request.Request(url_image, None, headers) print(url_image) #image, h = urllib.request.urlretrieve(url_image) with urllib.request.urlopen(req) as response: the_page = response.read() #print (the_page) with

Lemmatizing words after POS tagging produces unexpected results

老子叫甜甜 提交于 2020-01-05 03:54:05
问题 I am using python3.5 with the nltk pos_tag function and the WordNetLemmatizer. My goal is to flatten words in our database to classify text. I am trying to test using the lemmatizer and I encounter strange behavior when using the POS tagger on identical tokens. In the example below, I have a list of three strings and when running them in the POS tagger every other element is returned as a noun(NN) and the rest are return as verbs (VBG). This affects the lemmatization. The out put looks like

qgis ModuleNotFoundError: No module named 'PyQt5.pyqtconfig'

╄→尐↘猪︶ㄣ 提交于 2020-01-04 04:29:50
问题 Traceback (most recent call last): File "D:/Study/qgis3/QGIS/cmake/FindPyQt5.py", line 34, in <module> import PyQt5.pyqtconfig ModuleNotFoundError: No module named 'PyQt5.pyqtconfig' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:/Study/qgis3/QGIS/cmake/FindPyQt5.py", line 37, in <module> import PyQt5.QtCore ImportError: DLL load failed: Found SIP version: 4.19 Traceback (most recent call last): File "D:/Study/qgis3/QGIS/cmake

VIDEOIO ERROR: V4L: can't find camera device

被刻印的时光 ゝ 提交于 2020-01-03 16:54:18
问题 I am using ubuntu16.04 and trying to run opencv script. when i use: video_capture = cv2.VideoCapture(-1) it gives me error VIDEOIO ERROR: V4L: can't find camera device No video window opens But when i run video_capture = cv2.VideoCapture('test.jpg') It opens window shows the picture and close the window. Please tell me why it is not streaming video directly from camera. 回答1: The suggestion api55 gave in his comment video_capture = cv2.VideoCapture(0) is what I would try first. Generally, you

How do I run a Python 3.5 program that uses Tkinter on a computer without Python installed?

浪子不回头ぞ 提交于 2020-01-03 05:40:06
问题 I have coded a program in Python 3.5 that uses the Tkinter import. I'm trying to figure out a way to run it on computers that don't have Python. First I tried freezing it but I haven't been able to because none of the freezing tools I found support Python 3.5. Then I tried possibly using a online idle but I couldn't find any that support Tkinter. I would prefer to be able to get a .exe file or something similar but if I could run it online that would be good too any ideas? EDIT So I have now

How to create a filename with the current date and time in python when query is ran

南楼画角 提交于 2020-01-03 02:25:50
问题 When I run my query below, it creates a file called ‘mycsvfile’. However is there a way to add the current date and timestamp when the CSV file is created? For example if I run this query now the file should be named mycsvfile20171012 – 10:00:00 (something like that). Could someone edit my code and show me how to do this please? My code: from elasticsearch import Elasticsearch import csv es = Elasticsearch(["9200"]) # Replace the following Query with your own Elastic Search Query res = es