15,185 Topics

Member Avatar for
Member Avatar for mark103

Hi guys, I'm working on my python script to create the button for tv programs. I know how to create the variable to get the program title for the programs which I have to pull the data from the sqlite database. I can also create the variable for the height …

Member Avatar for chriswelborn
0
181
Member Avatar for entropicII

I'm using python to try and talk to my Arduino with pyserial. The code should wait for an input from COM5, (the arduino), and then sends a 1 and waits for the response. import serial connected = False ser = serial.serial("COM5", 9600) while not connected: serin = ser.read() connected = …

Member Avatar for woooee
0
2K
Member Avatar for acrocephalus

Hello, I am generating batch qr codes using the qrcode 5.0.1 package and the following code: from qrcode import * import os,dateutil import pandas as pd from PIL import Image #Importar base de dades pathFile = ('E:\Usuarios\Daniel\Documents\APNAE\QR\Llistat_socis_alta.csv') socisAPNAE = pd.read_csv(pathFile, delimiter = ';', encoding='ISO-8859-1') #generar codi QR for i in …

0
109
Member Avatar for acrocephalus

Hello, I have a code which generates QR codes from a csv file: #Importar base de dades pathFile = ('E:\Usuarios\Daniel\Documents\APNAE\QR\Llistat_socis_alta.csv') socisAPNAE = pd.read_csv(pathFile, delimiter = ';', encoding='ISO-8859-1') #generar codi QR for i in range(0,len(socisAPNAE.index)): soci = socisAPNAE.iloc[i,1:6] nom = socisAPNAE.iloc[i,1] nom = nom.encode('latin-1') qr = QRCode(version=20, error_correction=ERROR_CORRECT_L) qr.add_data(soci) qr.make() im …

Member Avatar for acrocephalus
0
345
Member Avatar for sneekula

There used to be a Python module called pyglet that allowed graphics and sound. I can't find it anywhere.

Member Avatar for sneekula
0
252
Member Avatar for mcroni

hi, i have written a function that can search through a folder and display a picture in a new window if the file is present but i always have to add the image file format or extension before the function can work. is there a way i can work around …

Member Avatar for vegaseat
0
276
Member Avatar for Jai_4

Write a program that reads n digit number. after reading the number, compute and display the sum of odd positioned digits,multiply all even positioned digits and add the two numbers. I have attempteed this problem like this a = input("Enter number") s = 0 p = 1 n = 1 …

Member Avatar for sneekula
0
785
Member Avatar for QwertyFish

Ok so I found this code online and though it looked interesting so I ran it but can someone tell me why it doesn't work? I have scapy installed btw #!/usr/bin/env python from scapy.all import * from scapy.error import Scapy_Exception m_iface="wlan0" filter_message="http" count=0 def pktTCP(pkt): global count if pkt.haslayer(TCP) and …

Member Avatar for QwertyFish
0
816
Member Avatar for cilla

How might I gather all the songs in my music library (maintained in iTunes) on Mac OS X 10.8.5 with ID3 title tags (I guess? their titles in iTunes) that consist of 4 random capital letters. Or all the ones whose titles are 4 characters long, case insensitive, or mixed …

Member Avatar for chriswelborn
0
194
Member Avatar for racigan

from xml.dom import minidom dict[1] = "country" xmldoc = minidom.parse('TestStep.xml') itemlist = xmldoc.getElementsByTagName('TestStepBody') print len(itemlist) print itemlist[0].attributes['Author'].value itemlist[0].setAttribute("Author",dict[1]); for s in itemlist : print s.attributes['Author'].value dict[1] value will be changing dynamically, So i need to dynamically change the attribute value of the Author in python. I this possible? if so …

Member Avatar for chriswelborn
0
3K
Member Avatar for sneekula

I would like to break up a list into sublists of 3 elements each. I have this code, but it will give an index error when the length of the list is not divisible by 3. mylist = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] …

Member Avatar for sneekula
0
258
Member Avatar for QwertyFish

Inspired by violent python and some of the scripts in there, I would like to make a http request sniffer to sniff http requests on a network. In the book violent python there is a tutorial for a section to make a google keg logger (gets what people search on …

Member Avatar for QwertyFish
0
1K
Member Avatar for jcafaro10

I'm having some trouble getting importing stuff from another class, I think I may be doing it wrong. I have a simple main class called Test and at the top I say: [CODE] from WordFixer import WordFixer import sys [/CODE] Then in the same folder (the src folder) I have …

Member Avatar for snippsat
0
155
Member Avatar for pratz

Hello, I have few question regarding importing modules. I have created a folder for my python work [quote]/usr/home/pratz/pyfiles[/quote] I have exported this to set the $PATH. And now if I issue the command [code]echo $PATH [/code] I am getting the string the "/usr/home/pratz/pyfiles" in the list. If I am not …

Member Avatar for Amigodornot666
0
516
Member Avatar for La

def askopenfilename(self): filename= tkFileDialog.askopenfilename(initialdir='C:/..',title='Select File' , filetypes=[('Bitmap Images', '*.bmp'),('Png Images', '*.png'),('Gif Images', '*.gif'),("Jpeg","*.jpg"),("All files", "*")]) self.entryVariable.set(filename) if filename == None: return open(filename,'rb') self.entry.update(filename) self.image = Image.open(filename) self.img = ImageTk.PhotoImage(self.image) self.canvas.config(width=400, height=300) self.lab.img = self.img self.lab.pack() self.canvas.create_image(1,1, anchor=NW, image=self.img) self.scrollbar_vert = Scrollbar(self.canvas) self.scrollbar_vert.pack(side=RIGHT, fill=Y) self.scrollbar_hor = Scrollbar(self.canvas) self.scrollbar_hor.config(orient=HORIZONTAL) self.scrollbar_hor.pack(side=BOTTOM, fill=X) self.canvas.config(yscrollcommand=self.scrollbar_vert.set) …

Member Avatar for vegaseat
-1
675
Member Avatar for rednose00

Hi all, i am trying to write a mortgage amortization schedule calculator and am stuck. please see the code below. It appears that the principal is being counted twice before subtracting it from the balance. Any ideas on what the issue is? I am new to python: loanAmount = input("Please …

Member Avatar for vegaseat
0
2K
Member Avatar for BingityBongity

I have a class containing: class CounterList: __n_comparisons__ = 0 def __init__(self, data=None): if data is None: self.data = [] else: self.data = data self.__n_accesses__ = 0 def __getitem__(self, i): self.__n_accesses__ += 1 return self.data[i] def __setitem__(self, i, item): self.__n_accesses__ += 1 if type(item) != CounterNode: raise ValueError("Only Counter objects …

Member Avatar for snippsat
0
375
Member Avatar for Ravi_exact

Hi, I have created one signal in python using pyside. I'm connecting with that signal 3 times with 3 different methods. when i emit this signal, it has to execute these 3 methods. It works perfectly fine. ValueChanged = QtCore.Signal(list) ValueChanged.connect(method1) ValueChanged.connect(method2) ValueChanged.connect(method3) valueChanged.emit([1,2,3]) But i would like to know …

Member Avatar for woooee
0
200
Member Avatar for kumarswamy_10

I am updating an xml file and want to preserve multiple namespaces with same URI but different anchor tag using ET.register_namespace Following code is what I've tried : <code> ET.register_namespace('', "http://oval.mitre.org/XMLSchema/oval-definitions-5") ET.register_namespace('', "http://oval.mitre.org/XMLSchema/oval-definitions-5#windows") ET.register_namespace('', "http://oval.mitre.org/XMLSchema/oval-definitions-5#independent") ns = "{http://oval.mitre.org/XMLSchema/oval-definitions-5}" f = open ("def_ex.xml","ra") tree = ET.parse(f) root = tree.getroot() for defn …

0
102
Member Avatar for entropicII

Recently, I've been trying to find out how to make my computer think that a button on the keyboard has been pressed using python. I want the whole system to think the key has been pressed. I need this to be possible in windows 7 and 8, on the latest …

Member Avatar for Gribouillis
0
2K
Member Avatar for javed.iqbal.3979

Hi everynone and Good Afternoon I am looking to implement a Program using Python for USB interfacing. How should i go for it.Any idea?

Member Avatar for chriswelborn
0
310
Member Avatar for abaddon2031

I have just figured out how to search for the element that im looking for in a xml file but now when I run it the code loops through i know 3 times maybe even more. I want to know what im missing that would cause it to loop like …

Member Avatar for chriswelborn
0
256
Member Avatar for racigan

Can any one help me in, creating the Python code for the below XML.Please copy it in to notepad <?xml version="1.0" encoding="UTF-8"?> -<TemplateBlock SchemaVersion="(3, 6, 0, 313)" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">-<Block ConstructorType="dstt_framework.DSTT_TestStep" IsCallerBlock="False" CollapsedState="False" EnableMode="True" Guid="u'{79DDB3BE-30F2-4CC4-AE65-C47A39390F34}'" ModifyTime="1409059399.51" CreationDate="1409059390.1270001" ResultLevel="1" ProtoType="''" DevelopmentNode="u''" LibraryDescription="u'To add a functional unit to the test sequence.'" Author="u't8187sa'" _CustomAttributes="{}" Description="u''" …

Member Avatar for Hiroshe
0
353
Member Avatar for VKG147

So I was learning python from "Learn python the hard way" in python3 (my preferance) (I also tried everything in the 2nd python) and when I came across "Parameters, Unpacking, Variables" I was stuck for good. When I type in exactly the same thing as he does: from sys import …

Member Avatar for Schol-R-LEA
0
735
Member Avatar for ramsha.shahid.3139

Hi all, I am working on simplest web browser import socket mysock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) mysock.connect(('www.py4info.com',80)) mysock.send('GET http://www.py4inf.com/code/romeo.txt HTTP/1.0\n\n') while True: data=mysock.recv(512) print data mysock.close() It's returning error 408:Request timeout at one time and at other runs smoothly but with incomplete output as: HTTP/1.1 200 OK Date: Sun, 14 Mar 2010 23:52:41 GMT …

Member Avatar for chriswelborn
0
375
Member Avatar for Mafiasays

Hello everyone. I was wondering if somebody could solve this problem for me. I have a bot that is required to refresh and grab back times here is the code for that task : def findNST(html): NST = re.findall(r'<td id="nst">(.*) am', html) if NST == []: NST = re.findall(r'<td id="nst">(.*) …

Member Avatar for Mafiasays
0
782
Member Avatar for Emmanuel_2

Below is a Python program I wrote to draw lines as many al there are mouse clicks. However, I wanted all the line segments to have the same attributes (eg: color, width etc), but that's not happening - only the last segment has my desired attributes. I am a beginner …

Member Avatar for vegaseat
0
285
Member Avatar for diliupgabadamudalige

Is there any way to encrypt/decrypt all image files and audio files with python storing them in a password protected file and then retrieving them again without slowing donw the decryption part?

Member Avatar for diliupgabadamudalige
0
204
Member Avatar for mcroni

#i use python 3xx from tkinter import * from tkinter import ttk # i couldnt install PIL on my computer so I used Pillow. Hope you dont run into any problems import datetime import pickle ## init the variables here since i dont use objects in your code name = …

Member Avatar for mcroni
0
704
Member Avatar for La

def askopenfilename(self): filename= tkFileDialog.askopenfilename(initialdir='C:/..',title='Select File' , filetypes=[('Bitmap Images', '*.bmp'),('Png Images', '*.png'),('Gif Images', '*.gif'),("Jpeg","*.jpg"),("All files", "*")]) self.image = Image.open(filename) self.photo = ImageTk.PhotoImage(self.image) self.label = Label(self.photo) def encode_files(self,image,data): #get the image file image = Image.open(self.photo) #get message from entry box data= self.data_entry self.encoded = LSBSteg.encode(image, data)

Member Avatar for sneekula
-1
229

The End.