2,190 Posted Topics

Member Avatar for Tenck

[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 …

Member Avatar for rproffitt
0
2K
Member Avatar for Regan_1

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 …

Member Avatar for Regan_1
0
345
Member Avatar for Kayla_1

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 …

Member Avatar for woooee
0
920
Member Avatar for genevish

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 …

Member Avatar for Swapna_1
0
856
Member Avatar for Cabba23

split() on <doc> first and then process each item separately in the returned list.

Member Avatar for Cabba23
0
243
Member Avatar for almostbob

I searched and searched and couldn't find an answer for this question. There are no answers to be found in a video game

Member Avatar for almostbob
6
561
Member Avatar for pwolf

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 …

Member Avatar for Abhinav_4
0
3K
Member Avatar for checker

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 = …

Member Avatar for Gribouillis
0
2K
Member Avatar for jarograv

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 …

Member Avatar for Wesley_1
0
13K
Member Avatar for Reverend Jim

> 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 …

Member Avatar for Reverend Jim
7
5K
Member Avatar for lost_scotsman

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 …

Member Avatar for Brandon Hatch
0
2K
Member Avatar for Pavol

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

Member Avatar for David W
0
307
Member Avatar for sajidk25

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 …

Member Avatar for vegaseat
0
361
Member Avatar for DumbBlonde89

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 …

Member Avatar for Gribouillis
0
7K
Member Avatar for lewashby

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.

Member Avatar for Gribouillis
0
474
Member Avatar for Sumit_6

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: …

Member Avatar for woooee
0
560
Member Avatar for jey1234

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.

Member Avatar for Tcll
0
1K
Member Avatar for Slass33

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 …

Member Avatar for Gribouillis
0
307
Member Avatar for Zeinab_1

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) …

Member Avatar for vegaseat
0
268
Member Avatar for DragonMastur

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 …

Member Avatar for woooee
0
6K
Member Avatar for Brandon500

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 …

Member Avatar for woooee
0
236
Member Avatar for getanshub4u

[QUOTE=;][/QUOTE] There is a list on the [url=http://wiki.python.org/moin/PythonBooks/]Python wiki[/url].

Member Avatar for dewhales
0
449
Member Avatar for anumash

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] …

Member Avatar for megaflo
0
334
Member Avatar for halo_123

[CODE]if "EMERGENCY" or "Help" or "!" in heading: pass elif ("no idea" in body) or (not Code() in body): pass[/CODE]

Member Avatar for PartVIII
-11
2K
Member Avatar for Jalcock501

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

Member Avatar for woooee
0
580
Member Avatar for Henry_5

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 …

Member Avatar for DragonMastur
0
800
Member Avatar for vegaseat

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 …

Member Avatar for vegaseat
11
9K
Member Avatar for AutoPython

You should use this with a try/except (within is while) since anyone would enter more or fewer characters at some time.

Member Avatar for 111100/11000
6
597
Member Avatar for jamesjohnson25
Member Avatar for Riya_2

"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 …

Member Avatar for woooee
0
192
Member Avatar for manateejoe

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.

Member Avatar for woooee
0
2K
Member Avatar for Reverend Jim

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...

Member Avatar for vegaseat
1
318
Member Avatar for BustACode

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 …

Member Avatar for Mark_37
0
276
Member Avatar for davidbr

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)

Member Avatar for Gribouillis
0
479
Member Avatar for cheeseman125

"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 …

Member Avatar for BustACode
0
246
Member Avatar for mark103

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 …

Member Avatar for woooee
0
281
Member Avatar for jamesjohnson25

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 …

Member Avatar for woooee
0
415
Member Avatar for 家宁

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.

Member Avatar for woooee
0
289
Member Avatar for Wumbate

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.

Member Avatar for woooee
0
10K
Member Avatar for RobertHDD

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.

Member Avatar for Reverend Jim
1
364
Member Avatar for CodeWarrior14

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, …

Member Avatar for vegaseat
0
352
Member Avatar for Taqwasarwar

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.

Member Avatar for vegaseat
0
311
Member Avatar for Niloofar24

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())

Member Avatar for Niloofar24
0
572
Member Avatar for bahubali.mangave.9

Not without knowing what argv contains. Print it and see for yourself. print argv print len(argv)

Member Avatar for woooee
0
163
Member Avatar for sneekula

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 …

Member Avatar for TrustyTony
1
14K
Member Avatar for throwaway123

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 …

Member Avatar for vegaseat
0
342
Member Avatar for Sruthi_2

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 …

Member Avatar for woooee
0
247
Member Avatar for techfreak

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

Member Avatar for woooee
0
238
Member Avatar for Greyhelm

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 …

Member Avatar for Greyhelm
0
344
Member Avatar for mark103
Member Avatar for mark103
0
658

The End.