15,190 Topics

Member Avatar for
Member Avatar for 00Gambit

from tkinter import * from random import randint #Return random color #RRGGBB def getRandomColor(): color = '#' for j in range(6): color+= toHexChar(randint(0, 15)) return color #Convert an integer to a single hex digit in a character def toHexChar(hexValue): if 0 <= hexValue <= 9: return chr(hexValue+ord('0')) else: return chr(hexValue …

Member Avatar for vegaseat
0
172
Member Avatar for ebaum2112

i am trying to make a checkerboard that centerss automaticly no matter what the sideLength is. also i am tryiing to put the checker in the squares...im only a beginner!!!! have mercy heres what i have [code] def drawCheckerBoard(myTurtle,sideLength): myTurtle.speed(0) for i in range (8): myTurtle.forward(sideLength) myTurtle.right(90) myTurtle.forward(sideLength) myTurtle.right(90) myTurtle.forward(sideLength) …

Member Avatar for ilona.lizard
0
220
Member Avatar for Tcll

as the title states, I know runpy can run a module's code w/o importing it, but what I'm trying to do is send the module object to a... function supplied by my interface which is directly called by the module. what I'm talking about is: my interface provides these functions …

Member Avatar for Tcll
0
539
Member Avatar for Amulya_1

Hi, I'm trying to compare two CSV files (and many more like these below). I tried many ways, using lists, dictreader and more but nothing gave me the output I require. I want to compare all those rows that have same !Sample_title and !Sample_geo_accession values (whose positions vary). I've been …

0
181
Member Avatar for johnny blaz97

import tkinter top=tkinter.Tk() t=tkinter.Text(top,height=1,width=1,bd=2,font=10) t.grid(row=0,column=0) b1=tkinter.Button(top,height=2,width=8,bd=2,text="MC",fg="Red") b1.grid(row=1,column=1) b2=tkinter.Button(top,height=2,width=8,bd=2,text="Backspace",fg="Red") b2.grid(row=1,column=2) b3=tkinter.Button(top,height=2,width=8,bd=2,text="CE",fg="Red") b3.grid(row=1,column=3) b4=tkinter.Button(top,height=2,width=8,bd=2,text="C",fg="Red") b4.grid(row=1,column=4) b5=tkinter.Button(top,height=2,width=8,bd=2,text="MR",fg="Red") b5.grid(row=2,column=1) b6=tkinter.Button(top,height=2,width=8,bd=2,text="7",fg="Blue") b6.grid(row=2,column=2) b7=tkinter.Button(top,height=2,width=8,bd=2,text="8",fg="Blue") b7.grid(row=2,column=3) b8=tkinter.Button(top,height=2,width=8,bd=2,text="9",fg="Blue") b8.grid(row=2,column=4) b9=tkinter.Button(top,height=2,width=8,bd=2,text="/",fg="Red") b9.grid(row=2,column=5) b10=tkinter.Button(top,height=2,width=8,bd=2,text="sqrt",fg="Blue") b10.grid(row=2,column=6) b11=tkinter.Button(top,height=2,width=8,bd=2,text="MS",fg="Red") b11.grid(row=3,column=1) b12=tkinter.Button(top,height=2,width=8,bd=2,text="4",fg="Blue") b12.grid(row=3,column=2) b13=tkinter.Button(top,height=2,width=8,bd=2,text="5",fg="Blue") b13.grid(row=3,column=3) b14=tkinter.Button(top,height=2,width=8,bd=2,text="6",fg="Blue") b14.grid(row=3,column=4) b15=tkinter.Button(top,height=2,width=8,bd=2,text="*",fg="Red") b15.grid(row=3,column=5) b16=tkinter.Button(top,height=2,width=8,bd=2,text="%",fg="Blue") b16.grid(row=3,column=6) b17=tkinter.Button(top,height=2,width=8,bd=2,text="M+",fg="Red") b17.grid(row=4,column=1) b18=tkinter.Button(top,height=2,width=8,bd=2,text="1",fg="Blue") b18.grid(row=4,column=2) b19=tkinter.Button(top,height=2,width=8,bd=2,text="2",fg="Blue") b19.grid(row=4,column=3) b20=tkinter.Button(top,height=2,width=8,bd=2,text="3",fg="Blue") b20.grid(row=4,column=4) b21=tkinter.Button(top,height=2,width=8,bd=2,text="-",fg="Red") b21.grid(row=4,column=5) b22=tkinter.Button(top,height=2,width=8,bd=2,text="1/x",fg="Blue") b22.grid(row=4,column=6) b23=tkinter.Button(top,height=2,width=8,bd=2,text="M-",fg="Red") …

Member Avatar for vegaseat
0
1K
Member Avatar for iamthwee

Has anyone ever used tkdocs... http://www.tkdocs.com/ And if so what have been your opinions thanks.

Member Avatar for vegaseat
0
144
Member Avatar for MustafaScript

x = 25 epsilon = 0.01 numGuesses = 0 ans = 0.0 while abs(ans**2 - x) >= epsilon and ans <= x: ans += 0.00001 numGuesses += 1 print 'numGuesses =', numGuesses if abs(ans**2 - x) >= epsilon: print 'Failed on square root of', x else: print ans, 'is close …

Member Avatar for vegaseat
0
2K
Member Avatar for Niloofar24

Hello. I'm using Linux OS, Python 2 and the last version of Kivy framework. Here i have 2 files that i have typed them exactly as what i watched on a kivy tutorial video. Fist file is "main.py": from kivy.app import App from kivy.uix.scatter import Scatter from kivy.uix.label import Label …

Member Avatar for vegaseat
0
4K
Member Avatar for steven.rose.94

Good Day:) I'm trying to figure out how to remove the % sign that is returned from scraping Yahoo Finance **without** removing the decimal point (or a possible negative sign in front of number returned as netProfit). My goal is to convert the string without the % sign a float …

Member Avatar for Slavi
0
2K
Member Avatar for MustafaScript
Member Avatar for Niloofar24

Hi. How can i open a mp3 file and play it in python? There is a mp3 file on my Linux desktop and i want to open it from a python file and play it. What should i do?

Member Avatar for Niloofar24
0
30K
Member Avatar for Niloofar24

Hi everybody. I have problem with .pack() and .grid(). I have to use this line: mywin.pack(fill=BOTH, expand=YES) I have used .grid every where on my file but now here i have copied a pice of code from some where and have pasted to my file, as you see it has …

Member Avatar for vegaseat
0
4K
Member Avatar for Niloofar24

Hello. When we want to insert a vlue into a table in sqlite, we use this line, right? cursor.execute('INSERT INTO colors Values ("red", "blue")') As we can see above, we want to insert 2 words and we type them as when we are typing whole the codes. But i want …

Member Avatar for vegaseat
0
5K
Member Avatar for rhys_1

memoryc = open("cipher.txt", "a") memoryd = open("decipher.txt", "a") #------------------------------------------------------------------------------- choice = input("cipher, decipher or memory") #------------------------------------------------------------------------------- if choice == "cipher": message = input("What is your message?") key = int(input("What is your key?")) coded_message = "" for ch in message: code_val = ord(ch) + key if ch.isalpha(): if code_val > ord('z'): …

Member Avatar for Ene Uran
0
317
Member Avatar for Johnny Blaz

https://friendpaste.com/mTdjXilQ0bVQJpsoCu1Wf i am having the error (float' object has no attribute 'insert').I am getting the same error with append. any solutions??? I am using python 3.4.2 .Thanks in advance.

Member Avatar for Gribouillis
0
202
Member Avatar for jac@

Hello i am new to programming i trying to solve the follwing Allow 6 different players to throw dice 100 times The results sholuld be stored in the collection SCORES. Read the contents of SCORES and output many times in total each number was thrown. Also output whether or not …

Member Avatar for HiHe
0
542
Member Avatar for Julie_2

I cant figure out what arguements to use or really even what arguements are. #Template for Program 2 #The keyword "pass" is a placeholder that does nothing #Move each line of original code into the appropriate module #Add arguments to calcBMI() and displayResults() as needed #original code -- not in …

Member Avatar for Julie_2
0
499
Member Avatar for giancan

Hi, I have two dictionaries and what I would like to do is to search if an item from dict1 is present at least 3 times in dict2. If so, do something. At the moment, I have something like this for line2 in list2: to_find=line2[3]+line2[4] if to_find in dic1: new_string=((" …

Member Avatar for giancan
0
233
Member Avatar for lewashby

if I have something like the following file = open(filename, 'rb') for line in file: #do stuff Once I find what I'm looking for in file and it's placed in the line variable, how could I then capture that position withing file, not just line?

Member Avatar for lewashby
0
200
Member Avatar for Froweey

Greetings: I've noticed that many people on these boards have experience using PyGame, so I thought it would be cool if i shared a creation I am currently developing. This creation is called **PyDark**. Basically, PyDark is a *2D game framework* built on-top of Python and PyGame. What makes PyDark …

Member Avatar for Gribouillis
1
153
Member Avatar for zac_2

I'm making a shooting game, how would I make the gun point towards the mouse cursor? Here's part of my code: y = 100 x = 100 screen = pygame.display.set_mode((800,600)) p = pygame.image.load("Person.png") player = pygame.transform.scale(p, (34, 86)) pygame.key.set_repeat(1, 1) mx, my = pygame.mouse.get_pos() while True: screen.fill(white) for event in …

Member Avatar for Froweey
0
167
Member Avatar for ShilohAmi

Hi, is that possible Tkinter to play a video? And if not possible so what GUI programming that you can recomended? I already search in google, find a few but there's dead link.. I need to show 2 windows, first the original video, and the second is video after processing

Member Avatar for ShilohAmi
0
1K
Member Avatar for vegaseat

I used csv data readily available from http://www.weatherdatadepot.com/ to create a multiline plot of the average monthly temperatures of a given location.

1
327
Member Avatar for ShilohAmi

If I have an array >>> a=np.array([[1,2,1],[3,4,2],[6,5,3],[7,8,4]]) >>> a array([[1, 2, 1], [3, 4, 2], [6, 5, 3], [7, 8, 4]]) and I want to find if first column which have value=6 and if second column have value=5 using "IF" "ELSE" I try with: b=6 c=5 if (b in a[:,0]) …

Member Avatar for ShilohAmi
0
241
Member Avatar for A_Dubbs

I am doing my homework and am having trouble on a certain problem. [I]4) A certain CS professor gives 100-point exams that are graded on the scale 90-100:A, 80-89:B, 70-79:C, 60-69:'D, <60:F. Write a program that accepts an exam score as input and prints out the corresponding grade.[/I] We have …

Member Avatar for vegaseat
0
13K
Member Avatar for webmeat

Hi everyone, I am having trouble comprehending or digesting the programming mentality. I'm learning Python and while I completely understand the syntax as well as the language itself, my problem is more toward the comprehension of thinking like a programmer. For example, once a programming exercise is explained, it all …

Member Avatar for Gribouillis
0
223
Member Avatar for Foday_1

def fileToString(filename): myFile = open(filename, "r") myText = "" for ch in myFile: myText = myText + ch return myText def countVowels(text): vcount = 0 vowels = ['a','e','i','o','u'] for letter in text: if (letter in vowels): vcount = vcount + 1 return vcount write a program to calculate the following …

Member Avatar for HiHe
-1
242
Member Avatar for doule

Hi, I am working on a GUI (more correctly, trying to), but I just don't really get it to work the way I want. The idea is to have a first list, where the user chooses one of the choices. Then depending on that choice, a new window pops out …

Member Avatar for Gribouillis
0
224
Member Avatar for amin2005
Member Avatar for HiHe
-2
112
Member Avatar for differentiation

The code that has been attatched (i couldnt post it for some reason) produces the error message: Traceback (most recent call last): File "filename", line 36, in <module> for i in range(len(bytesmessage)/7): TypeError: 'float' object cannot be interpreted as an integer In this line for i in range(len(bytesmessage)/7): The variable …

Member Avatar for HiHe
0
249

The End.