2,646 Posted Topics

Member Avatar for rbyrd

Is this blue enough ? self.btnClear = Button( self.frame, text="Clear Test", relief = FLAT, bg = "blue",highlightbackground="blue", fg="white")

Member Avatar for rbyrd
0
274
Member Avatar for Thomas_16

This is clearly homework. You must post your python code. Without code, there is no issue to solve.

Member Avatar for Gribouillis
0
68
Member Avatar for birinci2012

Probably the worst `isPrime()` function I've ever seen. If num is above 1000000, you are going to stack 1000000 recursive calls ! Python comes with a recursion limit >>> import sys >>> sys.getrecursionlimit() 1000 which means that your code will fail. The limit can be changed, but in every day programming, …

Member Avatar for slate
0
997
Member Avatar for giancan

I dont think there is a *good ratio*. I used this code import numpy as np import matplotlib import matplotlib.pyplot as plt data = """ 37 - 16 - good 21 - 12 - good 18 - 10 - good 19 - 8 - bad 26 - 12 - good …

Member Avatar for Gribouillis
0
239
Member Avatar for matmunn14

It looks very much like homework. Start with a program to print the letters of each word in alphabetic order.

Member Avatar for matmunn14
0
312
Member Avatar for trade19

Hi! Welcome to daniweb and the python forum! You can use a single Label import sys, random, tkinter # sample items without replacement L = list(range(1,60)) random.shuffle(L) g = L[:5] g.sort() f = L[5:6] drawing = ''.join([' '.join(str(G) for G in g),' ',str(f[0])]) print(drawing) app=tkinter.Tk() app.geometry('700x400+420+420') app.title(string=" LOTTO ") label5=tkinter.Label(app,text …

Member Avatar for Gribouillis
0
176
Member Avatar for crebz
Member Avatar for G_S

Use `u'à1'` and `u'é1'` or even better from __future__ import (absolute_import, division, print_function, unicode_literals) Currently, I even use from __future__ import (absolute_import, division, print_function, unicode_literals) from future import standard_library from future.builtins import * in python 2.7, where future is [this](http://python-future.org/) module.

Member Avatar for G_S
0
1K
Member Avatar for bnn678
Member Avatar for Gribouillis
0
213
Member Avatar for brittany.nelson.526

This error occurs when one tries to use a variable before it is defined at the left side of an `=`. The problem in your function `determine_loan_rate()` is that the ifs and elifs don't cover all the possible cases. In certain circumstances, the program can reach `return interest_rate` with none …

Member Avatar for TrustyTony
0
322
Member Avatar for novice20

It's an ill-posed problem, as mathematicians say. Why do you need your ip address ? Why doesn't 127.0.0.1 suffice ? Do you want the ip address on the local network (you should know it), or your public ip address ? There is an old trick [code=python] import urllib2 ip = …

Member Avatar for Suraj_2
0
928
Member Avatar for krystosan

I don't use macosx, but don't you miss some python development headers ? For example can you locate the file `Python.h` ?

Member Avatar for Gribouillis
0
515
Member Avatar for crebz

I suggest this if module `games.food` contains function `food()`, etc from importlib import import_module import games # games package has all modules to be used. The modules include color, food etc GAMES = ('color', 'food', 'car', 'toy') while True: question = input('Please enter your question: ').lower() if not question: break …

Member Avatar for crebz
0
234
Member Avatar for karmstrong

You can write searched = ['onetouch at', 'linkrunner at', 'aircheck'] def does_match(string): stringl = string.lower() return any(s in stringl for s in searched) for row in reader: if any(does_match(col) for col in row): writer.writerow(row[:2]) # write only 2 first columns

Member Avatar for Gribouillis
0
575
Member Avatar for Maurice_3

Perhaps try [this code snippet](http://www.daniweb.com/software-development/python/code/238387/really-simple-plugins-loader-import-all-modules-in-a-folder-in-one-swoop). Also please post code with correct syntax, preferably runable code.

Member Avatar for Gribouillis
0
1K
Member Avatar for tony75

I don't know this subject but did you try to connect using the standard module `smtplib` ? Also do you have a way to check that the server is running ?

Member Avatar for tony75
0
1K
Member Avatar for johnroach1985

First, use the `threading` module instead of `thread`, so start a thread with t = threading.Thread(target = runner, args = (list(previous_moves), processing, i)) t.start() I wrote `list(previous_moves)` because this creates a clone of the list. I don't think all the threads can share the same list object, or may be …

Member Avatar for Gribouillis
0
234
Member Avatar for Tcll

I have a starting point using module bitstring (from pypi) and the wikipedia page import bitstring test_data = [ ("0 01111 0000000000", 1), ("0 01111 0000000001", 1.0009765625), ("1 10000 0000000000", -2), ("0 11110 1111111111", 65504), ("0 00001 0000000000", 2.0 ** (-14)), ("0 00000 1111111111", 2.0**(-14) - 2.0**(-24)), ("0 00000 0000000001", …

Member Avatar for Tcll
0
849
Member Avatar for powerson65

I think the first thing to do is avoid the `import *` expression as much as possible. For example, use from tkinter import * from tkinter.messagebox import * from tkinter import Image import Tetrisino import colorfill import Simulation import os Then def Button3CallBack():#Caling the main function of the Tetrisino game …

Member Avatar for powerson65
0
3K
Member Avatar for ankman

After line 3, add print(repr(password)) print(repr(userguess)) then you can compare visually the two strings.

Member Avatar for Gribouillis
0
2K
Member Avatar for Tcll

Normally, you can't do that and you should not be doing that. However this is python and most things happen to be possible. A trick is to replace the module in `sys.modules` by a pseudo module object with the same dict and a `__call__()` method. Here is module `lemodule.py` in …

Member Avatar for Tcll
0
286
Member Avatar for zoro007

It seems that you must use the LIMIT keyword in the SELECT statement, as described in the [mysql documentation](http://dev.mysql.com/doc/refman/5.0/en/select.html). For example SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15 See also [this](http://www.phpsimplicity.com/tips.php?id=1). I dont know how it will interact with your ORDER BY clause.

Member Avatar for zoro007
0
243
Member Avatar for Tcll

As always, your code violates every rule of good design. It is possible, in theory, with a statement such as C.__class__ = B However you may find more help if you post the code of bu32, deref, bu() etc.

Member Avatar for Tcll
0
248
Member Avatar for franz.cheng.7

For the `cos(x)`, add `pi/2` to x, then compute `sin(x)`. For this use the Taylor series as ddanbe said above, but for faster convergence you can replace x with `x - 2*k*pi`, where k is chosen so that this new x is in the interval `[-pi, pi]`. Again you can …

Member Avatar for Gribouillis
0
301
Member Avatar for krystosan

I think you are trying to do something completely impossible. The first argument in Popen() must be a valid command line (either a string or a list, see the doc) which you could write in a terminal and execute. You can't write open(os.path.join(os.getcwd(), "foo.txt") "w") in a terminal and expect …

Member Avatar for krystosan
0
378
Member Avatar for Gribouillis

This python script prints all the columns of an sqlite database which path is given as argument.

4
877
Member Avatar for maurice.waka

This works for me with sqlalchemy from sqlalchemy import create_engine from sqlalchemy.engine import reflection engine = create_engine('sqlite:///menus.sqlite') # //// for abs path insp = reflection.Inspector.from_engine(engine) print insp.get_table_names() # print list of table names print insp.get_columns(u'menu') # print list of dicts, each containing info about a column in table 'menu' [reflection](http://docs.sqlalchemy.org/en/rel_0_9/core/reflection.html#fine-grained-reflection-with-inspector) …

Member Avatar for Gribouillis
0
348
Member Avatar for rbyrd

I suggest that you translate [wikipedia's pseudo-code](https://en.wikipedia.org/wiki/Graham_scan) into python. It looks like 20 lines of code ...

Member Avatar for dashing.adamhughes
0
161
Member Avatar for Vish0203

Replace last line with words[:] = [word for count, word in vow_count] This will replace the contents of list 'words' by your result. Also the line count = 0 should be inside the for loop. *Print* the result at the end of your function to see what happens.

Member Avatar for vegaseat
0
303
Member Avatar for Sharjeel Ali

I don't know web2py but did you explore the database with an external tool (phpmyadmin, sqliteman, ... depending on your db) to see if the data is still there ?

Member Avatar for Gribouillis
0
73
Member Avatar for Eric_8

*Optimizing* is different from reducing code size. Optimizing usually means change the code in order to reduce the execution time. Changing the code in order to have a better looking and shorter code is part of *refactoring*. The first criterion is code repetition. The functions `side_1()`, `side_2()`, `side_3()` are almost …

Member Avatar for Eric_8
0
381
Member Avatar for dashing.adamhughes

One thing is clear: the `__new__()` method is *not* the place where this should be implemented. The role of the `__new__()` method is to create an instance before this instance is initialized. Normally, you don't need to use it unless you subclass a builtin type or you are playing with …

Member Avatar for dashing.adamhughes
0
265
Member Avatar for Fakeyede

Consider a combination `(c,t,b)` with `n-4` tyres, if any. Add a car: you get a combination with `n` tyres. This covers all combinations having at least one car. It remains to generate the combinations without car. Consider all such combinations with `n-3` tyres and add a tricycle. This gives all …

Member Avatar for TrustyTony
0
286
Member Avatar for lewashby

The assignment statement r.size = 150, 100 is equivalent to r.size = (150, 100) As far as python's syntax is concerned, a single value is assigned, which is a tuple with 2 elements. Also note the use of decorators to declare properties: class Rectangle: def __init__(self): self.width = 0 self.height …

Member Avatar for Gribouillis
0
215
Member Avatar for lewashby

Try [PyInstaller](http://www.pyinstaller.org/) perhaps. Notice that most linux distributions ship with python 2 or 3 installed or both, or the other one can be installed with a few keystrokes, so I don't think a stand alone executable is very useful.

Member Avatar for TrustyTony
0
325
Member Avatar for hellohellohello

If you're using [openpyxl](http://packages.python.org/openpyxl/) instead of xlrd to read excel files, you must use .xlsx or .xlsm extension.

Member Avatar for akiva.berger
0
5K
Member Avatar for upadhyay_1

It is not python code. It looks like javascript. See in the [JavaScript / DHTML / AJAX](http://www.daniweb.com/web-development/javascript-dhtml-ajax/117) forum.

Member Avatar for rrashkin
-1
255
Member Avatar for srinu_1

Hm, a few visible issues: 1. Indentation of lines 8 and 9 is incorrect. 2. match is not a string, but a *match object*. Line 9 should probably be `f2.write(match.group(0))` (or 1 depending on what you want) 3. Always use raw strings in regex, such as `re.findall(r'...' ...)`. Raw strings …

Member Avatar for srinu_1
0
381
Member Avatar for aplh_ucsc

It's probably GetUserName() or GetUserNameEx() in the [win32api](http://timgolden.me.uk/pywin32-docs/win32api.html) module. The code in your post is very nice, but it is purely linux, and there is some work if you want to port this to windows.

Member Avatar for Gribouillis
0
4K
Member Avatar for GrimJack

I think Mandela is sanctified today because everybody, and particularly world leaders, want to promote peaceful coexistence of the different human races. As he spent 28 years in prison, I see him as a victim rather than a saint. He is a *dissident* in the sense used for dissidents of the …

Member Avatar for GrimJack
2
838
Member Avatar for Zahra_1

Use [the python tutorial](http://docs.python.org/3/tutorial/controlflow.html#if-statements) for correct syntax.

Member Avatar for sneekula
0
3K
Member Avatar for kuchi

It could be John Zelle's module [graphics.py](http://mcsp.wartburg.edu/zelle/python/).

Member Avatar for vegaseat
0
324
Member Avatar for Gribouillis
Member Avatar for angelina_1

Use a datetime.timedelta instance to represent the difference between two dates yA, mA, dA = 1969,7, 21 yB, mB, dB = 2013, 12, 22 import datetime as dt dateA = dt.date(yA, mA, dA) dateB = dt.date(yB, mB, dB) diff = dateB - dateA # a timedelta object print ("diff is …

Member Avatar for Gribouillis
0
387
Member Avatar for [V]

I think it is a parity error. Basically, you are looking for 2 consecutive words. Take the sequence `foo inhibited bar baz gated qux`. There are 3 pairs of consecutive words, `(foo, inhibited)`, `(bar, baz)`, `(gated, qux)`. Gated is not removed because it is not in second position in its …

Member Avatar for snippsat
0
195
Member Avatar for chophouse
Member Avatar for Overtim3

I don't understand what you want to hide. Is it something visible on the screen, like a cmd console, or is `some.exe` a GUI program ?

Member Avatar for Mouche
0
323
Member Avatar for a8med

> BTW in my Python at least he scandinavian letters are not allowed for names of Python objects. In my python 3.3.1, french accented letters are allowed, as in >>> incrément = 1 >>> hôte = '127.0.0.1' >>>

Member Avatar for a8med
0
174
Member Avatar for tony75
Member Avatar for ajit.nayak

Use the [csv](http://docs.python.org/2/library/csv.html#module-csv) module (standard lib) [discussion here](http://pymotw.com/2/csv/index.html#module-csv).

Member Avatar for slate
0
269

The End.