15,179 Topics
| |
I am writing an application in wxPython. It uses an XML file which populates a tree. When the application initialises it passes the XML file through xml.sax and stores all the data in a series of lists and dictionaries. One crucial element of the application is that a user can … | |
is there anyway to repeat a function every so often without using a while True: loop? im asking because in my GUI's they dont respond when proccessing large amounts of information. I want to display the information in real time without waiting for the while True loop to exit. Thanks … | |
Hi there, When I add a new row into the DataSet, the first time it works good but after the first time I added another row it's not working instead it generate this error message : "Update requires a valid Insertcommand when passed datarow collection with new rows" This is … | |
Does the documentation mean what it says? The 3.1 library reference says quopri.encodestring takes a string, but feeding it a string results in an error. [QUOTE]quopri.encodestring(s[, quotetabs]) Like encode(), except that it accepts a source string and returns the corresponding encoded string. [/QUOTE] However, feeding this a str results in … | |
Hey- I'm pretty new to python, and have a relatively simple task but I dont know the specifics about how to complete this task. I work in a research lab and part of the lab I'm not usually associated with uses a program that outputs data in a .txt file … | |
The following fails with an error message about not being able to encode the euro char. It works fine without the €. I have the feeling I'm missing something simple here, but can't figure it out. A fix would be appreciated. I'd like to use this in 2.5.4 and 3.1 … | |
Hello, I am not getting this sorting in python 3 with a key. If I don't use the key I get: [CODE] sorted_ent_list = entry_list.sort() TypeError: unorderable types: entry_T() < entry_T() [/CODE] If I do use a member function to return private variable from entry_T class, then it says [CODE] … | |
I just started learning Python last week, and I was having a few issues with doing a GUI app in Tk. My main problem is this: I have a list (each member of the list is a frame with a picture and some text in it) that populates itself by … | |
hello im new here on the forum.. so im using phyton 2.5.4 and i need help to finish this count loop [CODE=Python]while not inloged and not ended: sleep(1) print Time Time = Time - 1 if Time == 0: # os.system("shutdown -s") ended=True[/CODE] so now the count works good but … | |
I need help with a task: [QUOTE]For example, given the input: [CODE]doubloons[/CODE] your program should output: [CODE]Yarrrrrrr[/CODE] [/QUOTE] I don't know how to do the python script. I have never done Python before. Cohen | |
Hi I would like to know if there is any way to obtain a float result from a division between two integers other than using "from __future__ import division"? I am not looking for the .0 'trick'. Example 4/5.0 = 0.8. I want to be able to do 4/5 = … | |
Hi! I'am trying to make a program that dispalys a label with a image, but the rest of the program is "invisible", The problem I got is when I set the opacity, it affects the whole frame. This was ofcourse excepted, but I have not yet been able to make … | |
Hi. I am asking help for something that I have already done. However, I believe there is a much better way to do it. I am pretty novice to python and I don't know (yet xD) all of its capabilities and I am sure some of you will find this … | |
In an attempt to make my if statements cleaner, I figured out a simply way of making them quite a lot shorter. Instead of doing this: [code=python]elif talk_in == "quit" or talk_in == "q" or talk_in == "exit" or talk_in == "x":[/code] I can do this: [code=python]elif talk_in == ("quit" … | |
If I have a string, i.e.: s = "'Quote Example'\tby person\n" How can I display it to view the special characters untranslated, to see: "'Quote Example'\tby person\n" instead of: 'Quote Example' by person I need to know mostly for debugging purposes since the string is generated and doesn't follow a … | |
(a | b): For what I have read in other forum post, if a is true, python doesn't evaluate b an returns a. (a & b): What happens with logical and? If a is false, does python evaluates b or not? Thanks for your help. | |
The "exec" function seems to literally execute strings as code in a Python shell: >>> exec("a=2") >>> a 2 >>> However, when I tried this function from within a tkinter form, the variables were no longer accessible via their original names: a=1 #initialize the variable "a" exec(str(CodeTextBox.get())) # I entered … | |
Hi I am developing a spell checker for my language, and I came across solving an interesing problem. It would be great if you can suggest me an optimized solution for the problem described below: I have certain group of letters like these: Group #1: c,r,b Group #2: a,z,k Group … | |
[code=python] class ExcelDocument(): """ Some convenience methods for Excel documents accessed through COM. """ def __init__(self, visible=True): self.app = Dispatch("Excel.Application") self.app.Visible = visible self.sheet = 1 def new(self, filename=None): """ Create a new Excel workbook. If 'filename' specified, use the file as a template. """ self.app.Workbooks.Add(filename) def open(self, filename): """ … | |
I don't want to disturb you, but I don't understand how works the properties. I mean, using this simple code: #!/usr/bin/env python2.6 def cosas(self, width): return "cosas" class Rect(object): def __init__(self, width, height): self.width = width self.height = height self.area = 0 print "Adios" @property def _area(self): return self.width * … | |
My program doesn't make it pass these lines on one computer: [code] import re, os, glob, time os.chdir('/Software/xampp/htdocs/catalog/temp') file_list = glob.glob('Full-EP*.txt') file_dict = dict([(os.stat(a_file).st_mtime, a_file) for a_file in file_list]) date_list = list([key for key, value in file_dict.items()]) s = file_dict[max(date_list)] datePattern = re.compile(r'^Full-EP(\d{4})(\D{3})(\d{2})-(\d{2})(\d{2}).txt$') webdate = datePattern.search(s).groups() metadata = os.stat('WEB-Price-List.txt') dbdate … | |
I have read a little bit on XML and I will need it to get some information from already available XML files. I would like to learn it by making very small playlist. However I have encountered the two beasts. I don't know much of XML, especially with python. So … | |
hello im not very experienced with python so sorry for any bad code i am running ubuntu 8.10 and using pyserial i have made a script that reads the serial input from an arduino if you are not familier with an arduino here is there website [URL="http://www.arduino.cc/"]http://www.arduino.cc/[/URL] for some reason … | |
Hi, all Is there a way to get strings line by line from tk Text box? I know there is readline for files, but i don't see anything like that for tk Text box. Only thing i see is text.get(float(index1), float(index2)) but it seems unhelpful in my case, although it … | |
| Hey guys, I have already worked on a program which uses threads, but today I just wanted to work on threading, and only threading: [code=python] import threading class first_time(threading.Thread): def print_first_time(self): print("What is your name?") for x in range(1000): first_time().start() [/code] But, the problem is, nothing happens! Why is it … |
Hi, I'll try and explain my problem as simple as possible. I have written a module to perform a generalised operation (as shown below). [code] from math import sqrt from math import pow from math import log10 from Numeric import * import numpy as np def Entropy(parameters, temperature): t=float(temperature/1000.0) return … | |
Hi, I am new in Daniweb. I am trying to do a simple task in Python but cannot figure out how it works. Keeps getting it wrong. Basically, I have a main GUI class App which has 2 entry boxes where you fill two numbers, a listbox where the results … | |
[CODE] def find_and_sep(inputstr, thing_to_find): #thing to find is a string that is a regular expression #finds thing_to_find and returns tuple of the rest (before, thing, after) inputstr.strip() #match it m=re.match(thing_to_find, inputstr) #match first instance if(m==None): return "" start = inputstr[:m.start()] mid = inputstr[m.start():m.end()] end = inputstr[m.end():] tuple_x = start,mid,end return … | |
Hey guys, I need some help with Python (obviously). I need python to insert a space. I have: [CODE]name = raw_input('Enter your name? ') # prompt and read user's name [/CODE] and that works, and it asks me for a name, and insert it, then i got: [CODE]print 'Hello ' … | |
Ok, I really hated to resort to threading, but it seems like I have no other choice. I am writing a client script for the "instant message" server I just finished writing. Sadly, I am having a slight problem with threading. What I would like to do is have two … |
The End.