15,406 Topics

Member Avatar for
Member Avatar for Lolalola

Hi, I use exotic fonts and sometimes the text side-cut corners. How it fix? My code: [code=python] font = ImageFont.truetype(fontfile, fontsize) text_width, text_height = font.getsize(text) img = Image.new('RGBA', (text_width, text_height)) draw = ImageDraw.Draw(img) draw.text((0, 0), text, font=font, fill=(0, 0, 0)) [/code]

Member Avatar for woooee
-1
72
Member Avatar for Tenzing

Hello, I am new to this. What I am trying to do is take a .txt file and write parts of it to different lists. The file contains line sof FCODE,DESCRIPTION such as this: DAAS44,AIRSTRIP region ruin/inactive/abandoned I would like to split each line into FCODE and DESCRIPTION strings and …

Member Avatar for Tenzing
0
129
Member Avatar for Purnima12

[CODE]print (yourname1) snum = input('What is your date of birth (YYYYMMDD)?:') birth1 = snum[4:6] + '/' +snum[6:8] + '/' + snum[0:4] y1 = int(snum[0:4]) #year of person 1 m1 = int(snum[4:6]) #month "" d1 = int(snum[6:8]) #day '" print ('\n') print ('\n') sleep(1) print (yourname2) snum = input('What is your …

Member Avatar for Purnima12
0
2K
Member Avatar for Tech B

I am new to this website, well posting on here anyway. I've taught myself allot about programming and scripting, so I wanna thank everyone for posting. This isn't my first program, but its the first useful thing I've done. It uses the 'w', 'a', 'd', 's' keys to move the …

Member Avatar for Tech B
0
275
Member Avatar for letlet_pogs

Good day. I need help from those who know about my problem. How to get the total length of a string. I am trying to code that will get a total length of a string. However, if there one or more that have the same value, then it will not …

Member Avatar for lrh9
0
120
Member Avatar for Tops

Hi... Pls, how do i do character occurrence using dictionary in python. I want to count the number of each characters in a poem like this .. A----25 G---10 etc...

Member Avatar for d5e5
-1
115
Member Avatar for bharatk

Hello I'm making an GUI app to open a image and zoom it. This function is used to open the image & display it: [CODE] def file_open(self): filename =askopenfilename(filetypes=imageTypes) image1 = ImageTk.PhotoImage(Image.open(filename)) self.canvas.config(height=image1.height(), width=image1.width()) self.canvas.create_image(2, 2, image=image1, anchor=NW) self.image = image1 self.img_zoom(image1) # passing image1 to img_zoom function[/CODE] The image …

Member Avatar for bharatk
0
383
Member Avatar for rwbarrette

Once again, I'm stuck on a wx.python issue with regards to the floatcanvas. So... I have a script that erases and redraws an image in the canvas, based on changes made to two slider widgets (sldMFI, sldIDT). Before it redraws, I'm trying to define the current zoomed view as the …

Member Avatar for rwbarrette
0
346
Member Avatar for Yodamadashi

Hello, I have been working on a very simple Python Game so far (Not using pygame atm) and I ran into a problem that is very simple but I just do not know what to use to get it to work. Basically what I have right now is that the …

Member Avatar for sharmine
-1
719
Member Avatar for letlet_pogs

Hello, I am still a newbie in python. I am trying to slice a string, but I don't know how. [code] def start(): exp = "1+2"; string1 = exp.split("+"); print exp; print "Operator 1 is : " , op1; print "Operator 2 is : " , op2; [/code] I want …

Member Avatar for letlet_pogs
0
127
Member Avatar for A_Dubbs

Has anybody ever used py2exe and wxPython together? I have no idea what i'm doing (as usual) and would appreciate it if anyone could walk me through the process or point me to a tutorial online. All the tutorials I've seen (which isn't many) don't make much sense to me. …

Member Avatar for snippsat
0
752
Member Avatar for hughesadam_87

Hey all, I'm trying to read through a code written by a colleague last year in which he used the BioPython package. The package is no longer on my computer, and I have to wait for the systems admin to update it; thus, I'm forced to merely read the code. …

Member Avatar for keithsavin
0
114
Member Avatar for yoni0505

Hi there, I want to learn how to log in to websites using python 3.1, I've searched for any info and couldn't find. The closest thing I found was an example for older version of python, which I couldn't learn much from it cause the functions are not used in …

Member Avatar for snippsat
0
140
Member Avatar for txwooley

So I have figured out how to receive output from an application using [CODE]process = subprocess.Popen("my_app", shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE) info = process.communicate() [/CODE] But how do I SEND info TO an app? I have an application that asks for a yes(y) or no(n) confirmation …

Member Avatar for txwooley
0
84
Member Avatar for Lolalola
Member Avatar for Kruptein

If I do this code in the command line: [code=python]f = open(fl, 'r') txt = "" for line in f: txt+=line f.close() print txt[/code] I get all the output for the file fl, but if I do: [code=python] def editfl(self, fl): f = open(fl, 'r') txt = "" for line …

Member Avatar for vegaseat
0
238
Member Avatar for lyxus

Hello Folks, I have a data structure that is represented like this [CODE] { 1: { 'A1': [ 3, [ 'Val1' ] ], 'A2': [ 9, [ 'Val2', 'Val3' ] } 2: { 'A3': [ 2, [ 'Val4' ] ], 'A4': [ 1, [ 'Val5', 'Val6' ] ] }, #etc.... …

Member Avatar for Gribouillis
0
69
Member Avatar for ratchse

Hi i'm Krit I'm doing senior project about softphone. Main functions are video,audio calling, video, audio conferencing and IM. The server for sip I used Asterisk, XMPP is openfire (IM). Library I used PJSUA to make audio call [COLOR="Red"]but[/COLOR] video calling and conferecing. Please recommend the library that use for …

0
35
Member Avatar for learningpython

Hi I have several directories .. ex uselib is one directory with a file usoc.py and def pars has to be called in the file runner.py. I tried to see the existing ways and implement and obviously confused. So please someone let me know the logic behind calling and having …

Member Avatar for learningpython
0
117
Member Avatar for gunbuster363

Just as the title. I want to store some strings inside the program, and later I may store them(the string) in a text file. And I do not want duplicating strings. As I learned from school, I should use a hash table for it, but I may build a bad …

Member Avatar for lrh9
0
107
Member Avatar for petzoldt01

I am newish with python (ActivePython v2.6), and I am trying to automate AutoCAD 2010 (Acad) using module win32com (using acad's COM/ActiveX interfaces). Most of the interface is pretty straight forward, but I am getting hung up on functions that need to use VARIANTS to pass numerical arrays. Im not …

Member Avatar for petzoldt01
0
472
Member Avatar for EvaDo

Hi Guys, This seems easy, it just doesnt seem to work. I want to: loop through each file in a directory. each file contains a number of lines like this ">XXXXX" I want to extract each line that contains this,move it to a new file labelled almost identical to the …

Member Avatar for IsharaComix
0
76
Member Avatar for conord

Firstly - I'm a complete noob when it comes to Python. I'm currently trying to launch an external program called Dazzle from Python with a the path to an xml file as a parameter. I've tried a few different options and can get Dazzle to launch - but the xml …

Member Avatar for woooee
0
143
Member Avatar for PixelHead777

I'm trying to find a way to take a list of one-letter strings, for example, ['e', 'n', 'o', 't', 'r'] and find every order possible of these letters. I'll be able to, on my own, target the three words I would want for this, 'noter', 'toner', and 'tenor' (unless the …

Member Avatar for PixelHead777
0
89
Member Avatar for lrh9

I'm having a problem with 'os.path.getmtime'. I've been doing some research into generating '.pyc' files and I am able to retrieve the source modification time (in seconds) as recorded in the '.pyc' file. It is merely the second set of four bytes unpacked as a long integer. [code=Python] import random, …

Member Avatar for lrh9
0
2K
Member Avatar for gunbuster363

When I am processing the data, I put them inside some beautiful data structure for convenience, but then again I am done with my work, and I want to save the result in hard drive, I need to store them in a txt file, and for later usage, I need …

Member Avatar for sahiti
0
105
Member Avatar for Robbert

Hi - I have tried and tried with this, googled and what knot, but to no avail. I just need the frame to clear. The code below shows the overlay problem which I tried clearing with all types of panel.Clear() / self.panel.Clear() combos etc. [CODE] import wx class MyFrame(wx.Frame): def …

Member Avatar for vegaseat
0
175
Member Avatar for doctorjo5

I need to search for the hours of the day that each email was sent, then I need to create a dictionary from those. Then I need to print the dictionary at the end with the count of how many times an email was sent at each hour. Here is …

Member Avatar for doctorjo5
0
208
Member Avatar for mahela007

How do I copy folders using python? Shutil.copy doesn't work. it raises a permission denied error in windows

Member Avatar for svn799
0
114
Member Avatar for Noliving

The program I'm trying to create is one where it asks for an amount of money, lets say 10 bucks. It will take the input and then randomly come up with an amount of change that equals the input. So for example if you were to enter 10 bucks it …

Member Avatar for lyndon enero
0
91
Member Avatar for ssmokincamaro

Hey everyone, I'm fairly new to python and have hit a brick wall in a program I'm writing. I need to read in a text file containing values (No problems here) the text file looks like this 10, .25, .26 12, .44, .34 4, .22, .56 The numbers 10, 12, …

Member Avatar for snippsat
0
146
Member Avatar for richardtreier

I have problems running a compiled program with win32print and win32ui (to print an image) on a different computer. what shall i do?

Member Avatar for snippsat
0
81
Member Avatar for james0192

Hi, does anyone know how to make barcodes images with python? I downloaded PyBarcode but it comes with no real help andi really dont know where to start. So does anyone know how to use pybarcode or some other module?

Member Avatar for woooee
0
61
Member Avatar for james0192

Hi im writing a program and one of the things i need it to do is get today's date and display it at various times. creating the date using 'datetime' i can do the problem is passing the created date strings to different classes i currently have 2 classes one …

Member Avatar for woooee
0
2K
Member Avatar for Kruptein

I have a Frame called ChangeDirPanel and an other one called MyFrame, the last one is the top-lvl window and has a function called file_show_dir which updates a listbox in that same window. (both frames have their own class, is it better to have the same class?) I want to …

Member Avatar for Stefano Mtangoo
0
276
Member Avatar for james0192

Hi, i'm writing a project for my A-level course in python and ive come to a problem, i know the forum rules say not to expect a quick sollution and i dont want that as i like to understand things instead of doing them blindly. i've written a class which …

Member Avatar for james0192
0
3K
Member Avatar for Kruptein

Again I have problems with my classes :s I want to test if there is still text in the text_ctrl, if so it should give a warning in which you can chose to cancel, save or continue; but somehow the [icode]deditor.st = "continue"[/icode] is not passed :s [code=python]#!/usr/bin/env python # …

Member Avatar for Kruptein
0
123
Member Avatar for Lolalola

Hi, i download wmi from this: [url]http://timgolden.me.uk/python/wmi/index.html[/url] (windows version) [CODE=syntax] import wmi c = wmi.WMI () for process in c.Win32_Process (): print process.ProcessId, process.Name [/CODE] And run this script in Python 2.6 IDLE Show this error: Traceback (most recent call last): File "C:\Users\lola\Desktop\test.py", line 1, in <module> import wmi File …

Member Avatar for Lolalola
0
165
Member Avatar for wtzolt

I need help with something I'm working on. I'm new to python so bare with me. I have a string being randomly generated in such format (example): [CODE]F' B D D2 A2 C'[/CODE] [I]6 Letters from A to F with ether a number " 2 " or " ' " …

Member Avatar for wtzolt
0
122
Member Avatar for nimmyliji

Hi, I want to parse a date and change the format using python. Date has the format like 'Mon Feb 15 2010' and i want to change the format into '15/02/2010'. Any one can help me. Thanks in advance. Nimmy

Member Avatar for nimmyliji
0
45
Member Avatar for vsagarmb

Hi Guys, I am trying to pass a c structure from C to Python. Write the recieved structure at Python to a file, read back the structure from the file at Python and send it back to C. I am passing the structure as an array of bytes and write …

Member Avatar for vegaseat
0
158
Member Avatar for sindhujavenkat
Member Avatar for vegaseat
0
57
Member Avatar for nimmyliji

Hi, How can i check whether the GPRS connection is active or not using python? Is it possible to check it? Thanks in advance. nimmyliji

0
65
Member Avatar for kfancy

Hi all. Please edit/add/help me make this blackjack program work. Thank you. class Card: def __init__(self, suit, rank): self.rank = rank self.suit = suit if self.rank == 1: self.rank = "Ace" self.value = 11 elif self.rank == 11: self.rank = "Jack" self.value = 10 elif self.rank == 12: self.rank = …

Member Avatar for woooee
0
170
Member Avatar for surfershort

Hi everyone. I am in the process of building a surfing conditions forecast site for the UK, and at the moment im really struggling with GRads software to produce a swell chart from GRIB files for the UK - (North West Atlantic). I have discovered that there is a different …

0
51
Member Avatar for bharatk

I have opened an image using the PhotoImage method of ImageTk How do I close the image. This is the scenario is I am using it in. I have 2 buttons, one each to open an image from disk & image from url. When I open either of them the …

Member Avatar for bharatk
0
1K
Member Avatar for Hawkeye Python

I've read the documentation, but I still can't creat my own packages. How should the __init__.py look like? Cause i've tried to let it blank and some stuff like [CODE] my_package/ __init.py__ sub_pack/ __init.py__ test.py [/CODE] but it pointed syntax error If I don't write anything on it, no error …

Member Avatar for Ene Uran
0
96
Member Avatar for kfancy

import random class Card: def __init__(self, suit, rank): self.rank = rank self.suit = suit if self.rank == 1: self.rank = "Ace" self.value = 11 elif self.rank == 11: self.rank = "Jack" self.value = 10 elif self.rank == 12: self.rank = "Queen" self.value = 10 elif self.rank == 13: self.rank = …

Member Avatar for redyugi
0
178
Member Avatar for txwooley

How would I execute a command and have it's output returned as a list or string? For example (in Linux): [CODE]os.system("iwconfig")[/CODE] prints a list of wireless devices to stdout. How can I make Python see those results as a list or string so I can search for certain devices (like …

Member Avatar for txwooley
0
110
Member Avatar for kfancy

We're making blackjack and when we ask hit or stay, how do we make sure that the player gives us a valid response by typing either 'hit' or 'stay'? Thanks!

Member Avatar for jcao219
-1
102

The End.