15,179 Topics
| |
I want to convert letters "M", "E" and "D" into maritime flags from turtle import * def drawInitials (ref=(0,0), w=100, spacing=10): """Params: ref (int 2-tuple): bottom right corner, the reference point w (int): width of each letter, in pixels spacing (int): separation between consecutive letters, in pixels """ speed(0) drawInitials … | |
I am trying to send a message to my websocket server but I keep getting this error. Traceback (most recent call last): File "send.py", line 5, in <module> ws = websocket.create_connection("ws://ipaddress:9001") AttributeError: 'module' object has no attribute 'create_connection' I created a python server file server is started but when I … | |
Using Python, create a program that simulates a bank machine and transactions on a bank machine. Requirements: · Your bank machine must have an intro message that welcomes you. · The account balance is given at the beginning of the transaction and it should start at $1000.00. · It must … | |
import requests import pandas as pd import csv from bs4 import BeautifulSoup from pandas import Series,DataFrame import unicodecsv def name1(): url="https://www.agoda.com/zh-tw/pages/agoda/default/DestinationSearchResult.aspx? asq=%2bZePx52sg5H8gZw3pGCybdmU7lFjoXS%2baxz%2bUoF4%2bbAw3oLIKgWQqUpZ91GacaGdIGlJ%2bfxiotUg7cHef4W8WIrREFyK%2bHWl%2ftRKlV7J5kUcPb7NK6DnLacMaVs1qlGagsx8liTdosF5by%2fmvF3ZvJvZqOWnEqFCm0staf3OvDRiEYy%2bVBJyLXucnzzqZp%2fcBP3%2bKCFNOTA%2br9ARInL665pxj%2fA%2bylTfAGs1qJCjm9nxgYafyEWBFMPjt2sg351B&city=18343&cid=1732641&tag=41460a09-3e65-d173-1233-629e2428d88e&gclid=Cj0KEQjwvve_BRDmg9Kt9ufO15EBEiQAKoc6qlyYthgdt9CgZ7a6g6yijP42n6DsCUSZXvtfEJdYqiAaAvdW8P8HAQ&tick=636119092231&isdym=true&searchterm=%E5%A2%BE%E4%B8%81&pagetypeid=1&origin=TW&cid=1732641&htmlLanguage=zh-tw&checkIn=2016-10-20&checkOut=2016-10-21&los=1&rooms=1&adults=2&children=0&isFromSearchBox=true&ckuid=1b070b17-86c2-4376-a4f5-d3b98fc9cf45" source_code=requests.get(url) plain_text=source_code.text soup=BeautifulSoup(plain_text,"lxml") for a in soup.find_all("h3",{"class":"hotel-name"}): b=a.string.strip() print(b) csvfile=open('hotel.csv','w') wr=unicodecsv.writer(csvfile,encoding='utf-8') for item in b: wr.writerow(b) csvfile.close name1() I use python3 and win10 to write this code. I … | |
How can i set a frame according to parent window size? I was trying to set it but it is taking only region where button displayed from Tkinter import * class Example: def __init__(self, parent): self.parent = parent self.parent.title("CBLFinder") self.initUI() def initUI(self): self.frm1=Frame(self.parent,background="white",\ borderwidth=5,relief="sunken",\ width=400,\ height=500) #print self.parent.winfo_reqwidth(),self.parent.winfo_reqheight() btn=Button(self.frm1,text="Submit",command=self.update_frame) btn.grid(row=2,column=2,padx … | |
Alright. I'm teaching myself python from 'Learn Python the Hard Way: 3rd Edition' by Zed Shaw.. it's been informative so far. Definitely learning. After his lessons, he gives study drills, extra project to put your learning to use. He challenged us to: "Find out what Zork and Adventure were. Try … | |
Dear All, I have a very long list of values as follow (43, 560) (516, 1533) (1316, 3047) (520, 1528) (3563, 1316) (45, 557) (3562, 1312) (2686, 1964) (2424, 3340) (3559, 1317) (50, 561) (2427, 3336) (1313, 3046) (3562, 1313) (3559, 1318) (2689, 1962) (2429, 3339) (3721, 2585) (1317, 3048) … | |
Is there a way I can fix the way ji get neighbors of a 2d coordinate? """6.009 Lab 5 -- Mines""" def dump(game): """Print a human-readable representation of game. Arguments: game (dict): Game state >>> dump({'dimensions': [1, 2], 'mask': [[False, False]], 'board': [['.', 1]]}) dimensions: [1, 2] board: ['.', 1] … | |
I have generated checkbutton from inputstatus dictionary to set as default values.After tht once it get display on GUI when i select it respected text and status will be added to new dictionary '''inputstatus = { 'maggi': 1, \ 'pizza': 1, \ 'cold drinks': 1, \ 'fries': 1, \ 'chapati': … | |
Suppose i have one dictionary menu={'pizza':1,'Burger':1,'sandwitch':0} when i run tkinter gui these all key will be displayed on GUI. If value is 1 then respected key must be ticked rest will be unticked | |
There is one application where two radio buttons are available.i.e default and custom. If custom is selected then one panel will be visible which contain available drives list of not selected checkbox which are generated based on list but while i am doing such things it generate checkbox many time … | |
Write a program that prints a table of Celsius temperatures from 0 to 20 degrees and prints the corresponding temperature in Fahrenheit. This program MUST use a loop. The first digit in each temperature must line up with the first digit of the temperatures above it so the output forms … | |
from Tkinter import * from ttk import Style class Example(Frame): def __init__(self, parent): Frame.__init__(self, parent, background="#333") self.parent = parent self.parent.title("sample") self.parent.iconbitmap('sample.ico') self.pack(fill=BOTH, expand=1) self.centerWindow() self.initUI() def centerWindow(self): w = 500 h = 450 sw = self.parent.winfo_screenwidth() sh = self.parent.winfo_screenheight() x = (sw - w)/2 y = (sh - h)/2 self.parent.geometry('%dx%d+%d+%d' … | |
Hello, I'm totally new to programming and wanted to make a text-based game based on what I know, but I've met a problem I don't know how to fix. Also this code is not finished, I'm just trying to get it to work first. Basically, I want the loop to … | |
Okay, I'm trying to make a python game (not with pygame), I want it to use the arrow keys. But the thing is, I don't know how to get it to respond to the arrow keys. So here's what I want to do. If the user presses the up arrow … | |
Hello, I'm trying to use md5 in python3 using the attached code from hashlib import md5 password = 'pa$$w0rd' h = hashlib.md5() print(h.hexdigest()) put it gives me this error (cannot import name 'md5') and when i try to import hashlib only it gives this error (module 'hashlib' has no attribute … | |
My current program is text based, is there a way to convert it to a GUI based one? import sqlite3 from tkinter import* import sys import random from random import shuffle import time #------------------------------------------------------------------------------------------------------- def database1(): conn = sqlite3.connect("Database1.db") #connection to database #directory will need to be changed in order … | |
hello im harambe and need help with some course work for my GCSE's i like memes and message me if you can help as im 16 and my fianl exam is next week and i dont know aht an array is help!!!!!!!!!!! | |
Hi all, Ive been looking to convert one of my programs to include a GUI, and am having issues with the timing aspects of it. Ive included a mock scenario of what my problem is below: Ive defined my GUI as an object via a class, and am using the … | |
How to read properties file in Python? I found ConfigParser() but it has a 'section' limitation, so looking for other alternatives. Thanks, Harsh | |
How to update jquery on windows 7? my jquery stil 1.4.3 i want to change it become version 1.7.3 thanks before | |
suggest me whitch course is useful and booming in software industry...</> | |
Need to know steps of generating HTTP request multiple times in python | |
have a code that loads an image online with the AsyncImage module in kivy. i wrote the code in python3 which runs well on the pc but doesnt work on a packaged apk. i think this is because i packaged it using python2.7 buildozer. thanks an image showing the error … | |
Hi, I am trying to create something which you can type into entry boxes, then save that information to a .txt file. I have got this to work however I wish to name the file as what is stored in one of the entry boxes and cannot figure out how … | |
int* poly = new int[lines.size()]; for(int i=0;i<lines.size();i++)poly[i] = - 1; int curPoly = 0; vector<vector<cv::Point2f> > corners; for (int i = 0; i < lines.size(); i++) { for (int j = i+1; j < lines.size(); j++) { cv::Point2f pt = computeIntersect(lines[i], lines[j]); if (pt.x >= 0 && pt.y >= 0&&pt.x<img2.size().width&&pt.y<img2.size().height){ … | |
I'm writing a code that requires me to import multiple python files that are similiar to that of a .obj file, in the sense that they will create a 3D figure using vertices and lines, etc. The problem is, the files will have the same name for a list (called … | |
Hi all, I have been trying to use python to automate a sequence of processes on my computer, one of which is starting a hosted network. I have used subprocess to interact with command prompt (windows 10), and am struggling to pass sequential commands. I am trying to first send … | |
Hello, Im trying to install pymongo package to be able to connect to MongoDB using pip pip install pymongo but it produce the below error Could not find a version that satisfies the requirement pymongo (from versions: ) No matching distribution found for pymongo | |
Hello, i have a sample web appliaction which get a value from HTML text feild and redirect to HTML page according to the value passed but the problem is that i can't get the value entered in the html text throught (request.form) method I get the below error werkzeug.routing.BuildError: Could … |
The End.