2,190 Posted Topics
Re: [quote]Edit: It seems that I haven't to place a full directory path. Can someone help me out with this?[/QUOTE]The directory either has to be in the PATH or you can call it in the current directory with python ./script1.py or just ./script1.py if on Linux and the script is executable … | |
Re: All of the widget.get() statements are called when the widgets are created, i.e. before anything is entered. See the example for the Entry using a button to get the results, the other widgets are the same at effbot http://effbot.org/tkinterbook/entry.htm So start with one widget and test it until it does … | |
Re: You don't increment "count" correctly in the file input (I would guess since we don't know the layout of the file). The printing of lastname, firstname, etc. should show that. Also, use one lookup function only. Past the list to use to the function. So to lookup lastname, pass the … | |
Re: A complete error is required as it contains the offending line. I would guess that you would be passing a dictionary to Remote instead of browsername and platform, if you were using an data/instance attribute (self), but "capabilities" is a [class attribute](http://www.diveintopython.net/object_oriented_framework/class_attributes.html). class VerifyAboutPage(unittest.TestCase): capabilities = None def setUp(self): driver … | |
Re: split() on <doc> first and then process each item separately in the returned list. | |
Re: I searched and searched and couldn't find an answer for this question. There are no answers to be found in a video game | |
Re: Instead of the dictionary, which is fine, you can add 12 to the time if "PM" and less than 12. And another point that is picky for the example, but relevant in other things you might do, is to use endswith instead of in, to only catch AM of PM … | |
Re: To use the AgeName class instance, with the name in the dictionary pointing to each class instance, you could do something like this. [CODE]from math import sqrt class AgeName: """class to represent a person""" def _init_(self): ## 'name' is redundant since it is the key of the dictionary ##self.name = … | |
Re: Note that this line will never be true because city_name is a string, i.e. "0" != 0. if city_name==0: Also you compare if xcoord==0: twice and don't check ycoord. You can combine all of the input into a loop and avoid the redundancy, and FYI you are writing to a … | |
Re: > Your allowed to split infinities now and I do it the odd time. If the reader doesn't understand, he still won't understand if you switch the words around But you are not allowed to subsitute "your" for the contraction of you are=you're Your cat ran away You're looking for … | |
Re: First, pygame is probably a better option to display a stream. The end-of-file pointer is not updated until the file is closed so it shows zero length. I can't tell from the code if the file is closed or not after the capture and write. You want something similar to … | |
Re: Please post the code you have tried so far, to be used as a starting point. The question can not be answered until we know how "e, 2, 1" is similar | |
Re: They are all True on my computer as each pair points to the same address in memory (although I am on a 64 bit computer and it may be different on a 32 bit machine). Python keeps a list of objects for all "small" integers so they don't have several … | |
Re: Note that if someone enters anything other than a number, the program will fail, but It doesn't say anything about testing the input so you are probably OK as is. If you have 2 while() loops in a row, then you will have to enter the data twice, once for … | |
Re: Same here. I usually write it in Postscript and convert it, or when it is simple, do it in LibreOffice and save the file as a PDF. | |
Re: Frist you have to determine the length of the final list. Then append zeroes unless the list offset is in the dictionary passed to the function. def convert_dictionary(dict_in): """ a dictionary's keys are not necessarily in entry order """ print max(dict_in.keys()) print dict_in.keys() convert_dictionary({0: 1, 2: 1, 4: 2, 6: … | |
Re: I don't think there are many people here who use Pyglet. Many use Tkinter or Wx with a few Pyside/QT people thrown in. The Pyglet main page says that pyglet-users is the main forum, and should know more about it than we do. | |
Re: Good luck getting someone to go through 768 lines of code. Present a simplified form of the part that is not working, like the following """ This does not allow for a word that has the same letter multiple times Nor does it exit when the word is guessed before … | |
Re: Use the codecs' encoding parameter when reading and writing, although you can do it manually yourself, I find that this method works without problems. Also, note that how it prints depends on the default encoding of your OS. import codecs s = b'B1=A\xF1adir+al+carrito\n'.decode('latin-1') with codecs.open('lat.txt', mode="wb", encoding='latin-1') as fp: fp.write(s) … | |
Re: You use rowconfigure and columnconfigure. If you comment one of them out in the following example, it will only expand in the direction of which ever was not commented. try: import Tkinter as tk ## Python 2.x except ImportError: import tkinter as tk ## Python 3.x def column_row_expandable(): """ the … | |
Re: Perhaps "using a list" means something more along the lines of the following. Your code is redundant in that the values are in the list and in a, b, & c. Note that a fib sequence can start with any 2 numbers--the following uses zero and one, but you could … | |
Re: [QUOTE=;][/QUOTE] There is a list on the [url=http://wiki.python.org/moin/PythonBooks/]Python wiki[/url]. | |
Re: To further the foo_1 is not mutable (when it is changed it resides at a new memory address). foo_1=3 print "at memory address", id(foo_1) foo_1 += 2 print "not mutable so new value=new address" print id(foo_1) print "\n lists are mutable (same memory address)" foo_1 = [3] print id(foo_1) foo_1[0] … | |
Re: [CODE]if "EMERGENCY" or "Help" or "!" in heading: pass elif ("no idea" in body) or (not Code() in body): pass[/CODE] | |
Re: Tkinter variables are different (classes) from Python variables so you always have to convert one to the other. In Tkinter a StringVar shows any changes as they occur (to the StringVar). See the simple example at effbot http://effbot.org/tkinterbook/entry.htm showing set() --> Python to Tkinter, and get() --> Tkinter to Python | |
Re: Add some print statements to self.search_capture() to see where the append to the list is happening incorrectly, as obviously the length never equals zero. Note that in "right" and "left" either the row or the column should be the same, and you add/subtract from both. I would suggest that you … | |
Re: No one knows how or why magnets attract and repel. From the March, 2008 Scientific American: "Then there was the study that questioned the efficacy and purpose of the intensive screening of travelers at airports. The researchers, from Harvard University, the Massachusetts Institute of Technology and the Washington University School … | |
Re: You should use this with a try/except (within is while) since anyone would enter more or fewer characters at some time. ![]() | |
Re: "result" has not been declared so the line below will error. Note that "list" is a reserved word, i.e. Python already uses it, so you should use another variable name. if word not in result and letter in word: Your function returns words for one found letter. Use a loop … | |
Re: And threads may be overkill here. You could call one function periodically (Tkinter's after method) that does or does not read each port depending on the value of a variable(checkbutton_variable.get) associated with that port. | |
Re: Already posted this once elsewhere To tell you the truth (how long have you been lying) Anything that requires a "but" i.e. I don't want to interrupt but... | |
Re: Today's compilers are optimal, meaning comments don't make it into the final code, so you can just comment those lines, i.e. the if statement and everything beneath it. It is almost a certainty that you will want them again. The input will change or the program will have to be … | |
Re: I am assuming that your question was already answered here http://stackoverflow.com/questions/30137630/open-frame-from-button Statements like this say that you are indeed confused by the inheritance. for F in (PageSTART,PageSELECT,PageZS,PageARH,PageSET,PageHLP): frame = F(container, self) | |
Re: "ans" is never changed under the "while ans" loop so it loops continuously. A function [Click Here](http://www.tutorialspoint.com/python/python_functions.htm) would make things easier and cleaner def get_numbers(number_to_get): return_list = [] lits = ["first", "second", "third", "fourth", "fifth"] for num in range(number_to_get): input_num = raw_input("enter your %s number " %(lits[num] )) return_list.append(input_num) return … | |
Re: There is no way to tell which "position_start" to use in the following code, as there are two with the same name in the for() statement. As for the problem, print the list(s) on the line before the for() statement to see what it contains. Finally, you should check that … | |
Re: First, try it with "shell=True" (see the link below). And post which version of Python and the OS you are using. You can capture the output and write it to a file yourself so you know if you are getting that far or not. See the Python Module of the … | |
Re: There also has to be a button that is pressed, or some other event trigger, to tell the progam when to get the value from the input GUI. | |
Re: Take a look at the following thread in Daniweb https://www.daniweb.com/software-development/python/threads/452441/tkinter-entry-value-problem There are more examples under the "Python GUI Programming" thread at the top of the python page. | |
Re: Radio and TV are advertising mediums. The only reason there are shows is to get people to watch the ads. Remember that there is an off button, and exercising your right to choose can force improvement. | |
Re: You ignore spaces in the encoded message and insert a space at the appropriate number, ie. is in "key". def decode(message, key): output=[] for ctr, ltr in enumerate(message): if ctr in key: output.append(" ") if ltr != " ": output.append(ltr) print "".join(output) decode("HELLO WORLDT HISIS SOC OOL", [5, 11, 16, … | |
Re: You have to strip() each line to get rid of spaces and newlines, and then test for length greater than zero. That will skip any lines with spaces only. | |
Re: You split them and add a newline so they are on new lines. We don't know what type of variable favorite_movies is so there is no way to give an exact answer, but it is something along the same lines as favorite_movies="spiderman lastnight matrix" print favorite_movies print "\n".join(favorite_movies.split()) | |
Re: Not without knowing what argv contains. Print it and see for yourself. print argv print len(argv) | |
Re: Produces can't find clip error on Slackware and Python 2.7 Linux uses xclip as it does not view the OS and GUI as the same thing, but "Xclip", "xclip", and "xclip -selection c" produced the same error. Traceback (most recent call last): File "./test_1.py", line 108, in <module> copy2clip(byte_text) File … | |
Re: First you have to define the limits of the character set. Are you using English/ASCII as other character sets have an extended range? Do you want to encode special characters as well, @. ?. $ etc. For your purposes, ASCII goes from decmal 32, space, through decimal 126, ~. You … | |
Re: Since each increment is 4 times the previous, you should be able to divide the size by 1024 and use that. But to use the form you posted, you first want to traverse the directory(s) once only instead of every time the function is called, and store the numbers in … | |
Re: To execute a string you can use subprocess.call("string to execute", shell=True) See Doug Hellmann's subprocess explanation for additional info http://pymotw.com/2/subprocess/index.html#module-subprocess | |
Re: You start with a list full of ? and replace each ? with a letter when guessed correctly. ## assumes both words are the same length def display_matches(matches, test_word, sample_word): """ H?L? HELP HEL? HELP HELP HELP """ for ctr in range(len(test_word)): if test_word[ctr] == sample_word[ctr]: matches[ctr] = test_word[ctr] print … | |
Re: for elem in self.programs_button: That statement is not in the code you posted. |
The End.