4,305 Posted Topics

Member Avatar for Zahra_1

You have quite a few mistakes. This will work, look at it closely ... import random # optional, make string input work with Python2 or Python3 try: input = raw_input except: pass dice = random.randrange(1,5) dice2 = random.randrange(1,7) dice3 = random.randrange(1,13) info = ''' Which sided dice would you like …

Member Avatar for vegaseat
0
240
Member Avatar for ganapathy24
Member Avatar for ganapathy24
0
295
Member Avatar for HiHe

Right now they are trying to improve the response time. As far as I can figure out there is an insurance market place that lets you pick an insurance company and plan for your needs. However, everyone has to have maternity care and drug rehab in their plan. That's when …

Member Avatar for mike_2000_17
1
858
Member Avatar for vegaseat

This is an example of a singly linked list allowing you to enter a number of names and associated ages. The twist is that the names are inserted into the list in ascending order. When the list is displayed, it is already sorted by name. Note: This is not an …

Member Avatar for Ancient Dragon
1
470
Member Avatar for vegaseat
Member Avatar for mrnutty

I took vegaseat because everything else was already taken. Las Vegas, great place to eat top notch fine food.

Member Avatar for Reverend Jim
0
687
Member Avatar for Bilal93

One way to do this that looks a lot more like C++ code ... // circle_calc101.cpp // ask for radius of a circle and show area and circumference #include <iostream> #include <string> #include <sstream> int main(void) { std::string response; float radius; float pi = 355.0/113; // good approximation of pi …

Member Avatar for vegaseat
-1
197
Member Avatar for vegaseat

PySide's QWebView can load a given url and display the web page associated with it with just a few lines of code.

1
1K
Member Avatar for Ancient Dragon
Member Avatar for belladiluna

This might help ... http://pytools.codeplex.com/wikipage?title=NumPy%20and%20SciPy%20for%20.Net

Member Avatar for vegaseat
0
5K
Member Avatar for marin_10

This might help ... ''' datetime_add_time101.py add 1 second to a time near midnight some time format specifiers ... %a Locale's abbreviated weekday name %A Locale's full weekday name %b Locale's abbreviated month name %B Locale's full month name %c Locale's appropriate date and time representation %d Day of the …

Member Avatar for vegaseat
0
265
Member Avatar for idiotguy

Python3 is the best way to go at this point in your development. For a GUI toolkit that also allows some scripting look at PySide (PyQT). For example: [url]http://www.daniweb.com/software-development/python/threads/191210/1597999#post1597999[/url] Something to play with: [code]# PySide is the official LGPL-licensed version of PyQT # You can download and use the Windows …

Member Avatar for Tcll
0
714
Member Avatar for vegaseat

Shows you how to get a Python object's memory size. Notice that there can be a difference between Python versions.

Member Avatar for Tcll
3
527
Member Avatar for vegaseat

If you decorate a function, then some of the information is lost during the debugging process. Python supplies another decorator @wraps to help out. A decorator for a decorator, very interesting.

1
435
Member Avatar for Warrens80
Member Avatar for dean.ong.14

Did you by accident create a file tkinter.py in your working directory (where your program code is)? It would be imported first.

Member Avatar for Gribouillis
0
14K
Member Avatar for CodingCabbage

You could bind the event to pass certain arguments ... # Tkinter, show the text of the button that has been clicked # for Python3 use tkinter import Tkinter as tk def click(event): s = "clicked: " + event.widget.cget("text") root.title(s) root = tk.Tk() root.geometry("300x50+30+30") b1 = tk.Button(root, text="button1") b1.bind("<Button-1>", click) …

Member Avatar for vegaseat
0
994
Member Avatar for Warrens80

I go to one of the sandwich shops about once a week. This includes Panera Bread, Jimmy John's, Port of Subs etc.

Member Avatar for G_Waddell
0
234
Member Avatar for Jamblaster

I have to admire the folks that help on the C++ forum. The language can be tough for beginners and the questions are endless. So, I am hiding out on the Python forum, where programming can be downright fun. If I remember it correctly, I got my Hypocrite Medal during …

Member Avatar for diafol
1
376
Member Avatar for jaymista
Member Avatar for mike_2000_17
-1
257
Member Avatar for Ancient Dragon

Well, I went to Best Buy to get one of those fancy Sony Soundbars with a wireless woofer. Discounted at 30% off, not bad, and on Friday afternoon the only problem I had was parking. The problem at home was that my little terrier barks at the woofer. I have …

Member Avatar for vegaseat
0
192
Member Avatar for fsrgio

You got to give us more detsails. Not everyone is familiar with this game.

Member Avatar for fsrgio
0
155
Member Avatar for krystosan
Member Avatar for dean.ong.14

Am I going blind? I can't see a while loop in your code. Also, you can add a few "test prints" to help you debug this.

Member Avatar for vegaseat
0
244
Member Avatar for sandeeep11

You can put in a few test prints (also use type()) to help you debug your code.

Member Avatar for vegaseat
0
271
Member Avatar for CodingCabbage

With time.sleep() you need to tell Tkinter to update the root/label ... ''' display a GIF image on a Tkinter label at random positions ''' import time import random as rn try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk mainGUI = tk.Tk() width2= …

Member Avatar for vegaseat
0
373
Member Avatar for CodingCabbage

You can also take a quick look at ... http://www.daniweb.com/software-development/python/code/468841/tkinter-image-slide-show-python

Member Avatar for CodingCabbage
1
14K
Member Avatar for Cassidy_2

Actually Python2 has an input() function, but it is supposed to be for numeric input only. Python3 has changed that to string input and done away with raw_input().

Member Avatar for vegaseat
0
274
Member Avatar for Panarchy

Welcome to DaniWeb and the interesting world of Python coding! The Quiz.dat file is just a text file containing 6 lines per question. The first line is the correct answer code for the four possible answers (A, B, C, D), followed by the question and the four possible answers. For …

Member Avatar for EarthHorse
0
5K
Member Avatar for <M/>
Member Avatar for kakilang

Not quite ZZ Top but it's a start! The Windows Api has a little thing called Beep(), try it ... [code]// simple sounds via Beep(frequency_hrz, duration_ms) #include <iostream> #include <windows.h> // WinApi header file using namespace std; int main(int argc, char *argv[]) { Beep(523.2511,500); // 523.2511 hertz (C5) for 500 …

Member Avatar for 4reebahmedkhan
1
10K
Member Avatar for booicu
Member Avatar for venkaaaaat
Member Avatar for Warrens80
Member Avatar for CodingCabbage

See also ... http://www.daniweb.com/software-development/python/code/468072/a-button_namebutton_object-dictionary-tkinter

Member Avatar for vegaseat
0
243
Member Avatar for Astudent
Member Avatar for CodingCabbage

The matplot libray is the work horse for any type of plotting with Python ... ''' mp_barchart_vertical2.py make a simple vertical bar chart downloaded Windows installer (Python 3.3 version) matplotlib-1.2.0.win32-py3.3.exe from http://matplotlib.org/downloads.html tested with Python33 ''' from pylab import * # names of sales persons persons = ['Tom', 'Jean', 'Paul', …

Member Avatar for vegaseat
0
285
Member Avatar for Prithiv_1

Maybe something along this line ... dd = "{'a':1,'b':2}" print(type(dd)) # <type 'str'> d = eval(dd) print(type(d)) # <type 'dict'> print(d) # {'a': 1, 'b': 2}

Member Avatar for vegaseat
0
292
Member Avatar for Netcode
Member Avatar for Netcode
0
296
Member Avatar for <M/>

Indian narcotic cop arrests racially competent erotic recluse after triple escape woolworth

Member Avatar for <M/>
0
1K
Member Avatar for prashantsharmazz
Member Avatar for vegaseat

Shows you how to create multiple Tkinter buttons in a loop, each with its own name, label and command response.

Member Avatar for CodingCabbage
2
1K
Member Avatar for vegaseat

The code sample shows how to get an image from the internet and show it in a Tkinter label widget.

Member Avatar for Nils_1
4
2K
Member Avatar for Crazyscript77

To break out of a nested loop put it into a function and use return instead of break.

Member Avatar for Crazyscript77
0
187
Member Avatar for laleh.97
Member Avatar for rubberman
0
227
Member Avatar for nouth

Another option ... mylist = [('cat', 'meow'), ('dog', 'ruff')] for tup in mylist: print(" ".join(tup)) # use "" for no space

Member Avatar for vegaseat
0
249
Member Avatar for lewashby

Hint ... import sys # check if there is a commandline if len(sys.argv) > 1: mylist = [] # sys.argv[0] is the program filename, slice it off for element in sys.argv[1:]: mylist.append(element) else: print("usage {} element1 element2 [element3 ...]".format(sys.argv[0])) sys.exit(1) # if the arguments were 1 2 3 4 5 …

Member Avatar for vegaseat
0
236
Member Avatar for Iceman10284
Member Avatar for Waseemaburakia

Just as an exercise, a mild modification of woooee's code ... ''' bubble_sort_details.py count the number of tuple swaps performed ''' import random def bubble_sort(mylist): '''mylist is sorted in place''' swaps_ctr = 0 while True: swap_flag = False for ctr in range(0, len(mylist)-1): if mylist[ctr] > mylist[ctr+1]: # do a …

Member Avatar for Waseemaburakia
0
294
Member Avatar for Warrens80

Scooters are not as fatal as the "crotch rockets" most teens around here drive.

Member Avatar for Warrens80
0
168

The End.