15,179 Topics

Member Avatar for
Member Avatar for Fo.katia

Hello guys, I really need help with this one. Can you please help me create a program in Python that displays information about a rectangle of any size. Input: two mouse clicks for the opposite corners of a rectangle Output: Draw the rectangle. Print the perimeter and area of the …

Member Avatar for vegaseat
0
3K
Member Avatar for OnEaglesWingsjf

What's wrong with: def project_to_distance(point_x, point_y, distance): dist_to_origin = math.square_root(point_x ** 2 + point_y ** 2) scale = distance / dist_to_origin temp1= point_x * scale temp2= point_y * scale print temp1, temp2 print project_to_distance(2, 7, 4)

Member Avatar for vegaseat
0
334
Member Avatar for shammi.khan.73

Right now I'm trying to create an oppish translator. That is, after a consonant or several consonants in a row, you add 'op' to those letters. As an example, cow would become copowop or street which would become stropeetop. This is what I have so far: def oppish(phrase): #with this …

Member Avatar for Gribouillis
0
374
Member Avatar for lewashby

I'm trying to add /home/garrett/bin/libpy/ to my python path so I can import my own libraries, I would also prefer not to overwrite the default python path but rather append my own path to the default. When I try to `echo $PYTHONPATH` or `$PYTHONHOME` I get nothing and even if …

Member Avatar for Gribouillis
0
664
Member Avatar for psichoman5

I have a problem with concatenate strings in pyhton. I need to concatenate the string clave and cadena_aleatoria(x) while cadena_inicio is minor than 256. This is my script: Any help? .Thanks! import sys import random x = random.randint(0,9) def cadena_aleatoria(x): cadena = [] cadena.append(x) while len(cadena)<10: x = random.randint(0,9) cadena.append(x) …

Member Avatar for Gribouillis
0
181
Member Avatar for sritechprasad

Hi, What is the meaning of the code lines in python. How a single variable like "argv" can be assigned to multiple variables "script and filename". Python Code: **from sys import argv script, filename = argv**

Member Avatar for Gribouillis
0
174
Member Avatar for davidbr

Hi, I wrote a small app which have some different pages but now i have a problem with update dynamically a label text from one of the pages. I would highly appreciate if anyone can have a look and maybe help me... I want to update self.label1 from pag01 class …

Member Avatar for davidbr
0
8K
Member Avatar for NITHIN171
Member Avatar for fatalaccidents

Hello all, My question is hopefully particular enough to not relate to any of the other ones that I've read. I'm wanting to use subprocess and multiprocessing to spawn a bunch of jobs serially and return the return code to me. The problem is that I don't want to wait() …

Member Avatar for ~s.o.s~
0
4K
Member Avatar for saimasiddiqui

I am taking my very first programming class ad kind of stump on the problem mention in this post.. In coding I only got so far as what shows here.... 2. Write Python statements corresponding to the following: a. Assign to variable flowers a list containing strings 'rose', 'bougainvillea', 'yucca', …

Member Avatar for Gribouillis
0
1K
Member Avatar for Gribouillis

This snippet defines a function `printat()` which adds line and file information to the normal `print()` function output. The intended use is a quick and dirty debugging information for everyday's use. A more complete solution is to use a logging/debugging/tracing framework.

Member Avatar for Gribouillis
5
919
Member Avatar for tubs1

Hi All, Is GitHub the "gold standard" for finding open source scripts online for people to use in their own development? Where else do people look? Thanks, Tubs

Member Avatar for chriswelborn
0
197
Member Avatar for kiddo39

I'm trying to use this code for a fibonocci sequence where I'm setting the starting numbers as b= and c=. What I'd like to do though is have it stop after so many numbers are added together, in this case it would be 53rd (a=53). I've tried a 'for i …

Member Avatar for HiHe
0
233
Member Avatar for ibrahim.sawaneh.16

Hi, I am really stuck on this problem. I am supposed to write a function that takes in the number of rows of the mountain range as a parameter. The function will then draw a number mountain range on screen using the print function. There are X number of rows, …

Member Avatar for woooee
0
105
Member Avatar for kiddo39

Hi, If I have a sentence like this: "I now have a total of % yellow bananas!" but I need it to change the number 2 to a 3, print, then a 4, print, etc until it reaches a set number like 10, how can I go about that? sentence …

Member Avatar for kiddo39
0
271
Member Avatar for silverdust

On line 21 of this code where I have self.greetWelcome() . I'll love for that function to be called after the GUI is loaded. What event do I have to listen for and on what object to call it after the GUI is loaded. As of now, it works before …

Member Avatar for silverdust
0
3K
Member Avatar for vegaseat

Similiar to the snippet posted at: http://www.daniweb.com/software-development/python/code/449036/display-an-image-from-the-web-tkinter but this time we use PIL to resize the image from the internet keeping its aspect ratio to fit a specific display area/box.

Member Avatar for HiHe
3
2K
Member Avatar for vegaseat

The Pyside GUI toolkit (public PyQt) lets you bring up an interactive web page with its QWebView widget. Here is a simple example.

2
694
Member Avatar for EDWIN_4

Hello, in which senario do we normaly use this (*args,**kwargs)type of arguments in python.

Member Avatar for snippsat
0
149
Member Avatar for masterofpuppets

[CODE]from Tkinter import * root = Tk() tipwindow = None # Creates a tooptip box for a widget. def createToolTip( widget, text ): def enter( event ): global tipwindow x = y = 0 if tipwindow or not text: return x, y, cx, cy = widget.bbox( "insert" ) x += …

Member Avatar for richard.grigonis
1
354
Member Avatar for dani_boy

I have made a simple game that I want to add sound effects to. I have the short clips and can get them to work with the following command: import os os.startfile("filename") It plays fine, but the problem is that it plays the file(s) with windows media player: effectively taking …

Member Avatar for HiHe
0
3K
Member Avatar for amraam

The idea is to have an HTML page that looks like this: PROJECT1 Send what goes into the web form below to a python script! _________________________________________________ ____ | Input some text! | | GO | |_________________________________________________| |____| When the user hits "GO", the text somehow goes into script.py that does …

Member Avatar for amraam
0
6K
Member Avatar for psichoman5

Help! UnboundLocalError: local variable 'B' referenced before assignment. Thanks! if a >= 3: A = (3 ^(int(log((a/3), 2)* 3))) if b >= 3: B = (3 ^(int(log((b/3), 2)* 3))) if c >= 3: C = (3 ^(int(log((c/3), 2)* 3))) if d >= 3: D = (3 ^(int(log((d/3), 2)* 3))) if …

Member Avatar for woooee
0
464
Member Avatar for mark103

Hi all, I'm working on my python script as I'm pulling the data from the sqlite3 database. I'm trying to convert the string object to datetime object, but I have got a problem with the code as I get the error when I'm trying convert from the string object to …

Member Avatar for vegaseat
0
1K
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

The End.