15,175 Topics
| |
I am trying to make a small dice roll program. By using after(), I would like to make a small "image animation". that displays an other image every ... ms. Unfortunatly sofar only the final image(of the dice roll outcome) is shown and not the visual animation. Does any one … | |
import tkinter from tkinter import ttk top=tkinter.Tk() top.title("Scoreboard") top.configure(background="black") w=ttk.Scrollbar(top,orient='vertical') l1=tkinter.Label(top,height=2,width=67,bd=4,text="Welcome To Cricket World Cup 2015",font=("Purisa",15),fg="white",bg="red",relief="ridge") l1.grid(row=0,column=0,columnspan=67) l2=tkinter.Label(top,height=2,width=25,font=("Purisa",15),text="India",fg="white",bg="red",relief="ridge") l2.grid(row=1,column=0) l3=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="VS",fg="white",bg="black") l3.grid(row=1,column=1) l4=tkinter.Label(top,height=2,width=25,font=("Purisa",15),text="Australia",fg="white",bg="red",relief="ridge") l4.grid(row=1,column=2) l5=tkinter.Label(top,height=9,width=67,bd=4,font=("Purisa",15),bg="red",relief="ridge") l5.grid(row=3,column=0,columnspan=67) l6=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="India",fg="white",bg="Black",relief="ridge") l6.grid(row=3,column=0,rowspan=1,sticky="NW") l7=tkinter.Label(top,height=3,width=14,font=("Purisa",20),text="183/2",fg="white",bg="Black",relief="ridge") l7.grid(row=3,column=0) l8=tkinter.Label(top,height=3,width=14,font=("Purisa",20),text="45.1",fg="white",bg="Black",relief="ridge") l8.grid(row=3,column=2) l9=tkinter.Label(top,height=3,width=20,font=("Purisa",12),text="RR = 4.057 ",fg="white",bg="Black",relief="ridge") l9.grid(row=3,column=1,rowspan=1) l10=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="Toss = Australia",fg="white",bg="Black",relief="ridge") l10.grid(row=3,column=2,rowspan=1,sticky="NE") l11=tkinter.Label(top,height=7,width=67,bd=4,font=("Purisa",15),bg="red",relief="ridge") l11.grid(row=6,column=0,columnspan=67) l12=tkinter.Label(top,height=2,width=13,font=("Purisa",20),text="Player name",fg="white",bg="Black",relief="ridge") l12.grid(row=6,column=0,sticky="NWE") l13=tkinter.Label(top,height=2,width=12,font=("Purisa",20),text="Balls",fg="white",bg="Black",relief="ridge") l13.grid(row=6,column=2,sticky="NEW") l14=tkinter.Label(top,height=2,width=11,font=("Purisa",20),text="Runs",fg="white",bg="Black",relief="ridge") l14.grid(row=6,column=1,sticky="NWE") l15=tkinter.Label(top,height=1,width=10,font=("Purisa",14),text="44",fg="white",bg="Black",relief="ridge") … | |
#Template for Program 6 #Complete the code in each module as discussed in #the Program 6 Instructions def main(): #initialize variables so incomplete code won't cause errors #can be deleted once code is finished totalRainfall = 0 minRainfall = 0 maxRainfall = 0 #prints the progam title and a blank … | |
#Template for Program 4 #Note: This program does not require the use modules (Ch 3) #Remember to indent code that is within the for loop (4 spaces or 1 tab) #print the progam title and a blank line #get input for number of months and store as integer #for loop … | |
Hello, I have this code which is working import Tkinter as tk from Tkinter import * LARGE_FONT= ("Verdana", 12) class ChangePages(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) container = tk.Frame(self) container.pack() container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} for F in (MainPage, Page01, Page02): frame = F(container, self) self.frames[F] … | |
@Niloofar24 was looking for an Iranian datetime package and last night I found one in the internet so I wrote a simple code which counts the days and hours and seconds to Iranian new year | |
Hi friends! I want to create a countdown program. Here is my code: from kivy.app import App from kivy.uix.boxlayout import BoxLayout from kivy.uix.label import Label import datetime class CountdownApp(App): def build(self): delta = datetime.datetime(2015, 3, 21, 2, 15, 11) - datetime.datetime.now() days = delta.days days = str(days) self.label_days = Label(text=days … | |
Hello. I have a homework. I have asked to create a web crawler that be able to enter into a music website and then for the first step, collect the name of singers that their names starts with the letter "A". Now i need a little help for this step. … | |
Dear friends, I have a set of files created at certaing time. I would like to group the result where consecutive time difference is more than 1 minute. For example A 10:01:25 B 10:01:29 C 10:01:52 D 10:01:58 E 10:02:12 F 10:02:22 G 10:11:01 H 10:11:18 I 10:30:00 The above … | |
This is my code: from tkinter import * def ftm(feet): return feet * 0.305 def mtf(meters): return meters / 0.305 def convert(amount, func, result): value = func(float(amount.get())) result.set(round((value), 3)) def choose(): choice = lol.get() if choice == "ft": feet = StringVar() meters = StringVar() rest = Toplevel() f3 = Frame(rest) … | |
Instead of using letters as substitutes for playing card suits, I came up with a way to use unicodes to produce the common suits. The following creates the coded needed, makes the deck, and then prints the deck. The printing was the hard part. Is 2.7, and should be 3.0+ … | |
My code and funcs for printing to columns in 2.7 and 3.0+ using print(). I had to relearn column formatting as I moved to using the print() function, and so the follwing is a result. Inspired and partially copied from discussion on [StackOverflow](https://stackoverflow.com/questions/9989334/create-nice-column-output-in-python) def main(): # Main Code v_Data = … | |
Hi. How i can ask my crawler to print only the text of all <li></li> tags in a url page? I want to save the text of all <li></li> tags in a text file (without` <li></li>` words.) | |
One day I got to wondering if it was possible to get a Python script to modify itself. After a few searches I found [this](http://showmedo.com/videotutorials/video?name=7610000&#) solution that I present here. I did not write this code, but feel that it should be "paid forward" so others know that it is … | |
Hello! I've got a question about implementation of a standart tree model for TreeView. I have a response from database that lools like [ [A, [a,b,c]], [B,[a,b,c]], . . . [N,[a,b,c]] ] And I want to pass it through treemodel to treeview, for in GUI it looks like that: A … | |
Hi everyone, I am a beginner in python, and I would really appreciate if someone could help me with this. Basically I am trying to write a program where I will be importing a file that has a lot of numbers in many lines, there are also some blank spaces. … | |
Hello!!I have a database and I want to display its data into a QTreeView in PyQt.The database's column has file paths.I have a problem in filling this treeview with data because it's a database and I'm not sure if it is like working with txt files and because it is … | |
I am trying to sort averages of scores in a class by pupil, from highest to lowest. My data is stored in text files like this: Charlie:0 Seema:2 Amber:4 Paige:5 Amber:8 Keith:1 Charlie:8 Seema:0 Charlie:9 Seema:3 Paige:0 Paige:4 Paige:4 Charlie:1 Keith:5 Keith:3 Here is my code so far: with open("class … | |
I have been trying to create a program which the teacher log in to view the scores of a test of a school class. The scores are stored in a text file like this: Charlotte:7 Charlotte:4 Charlotte:3 Chelsea:2 Chelsea:9 Chelsea:5 Jeff:1 Jeff:10 As you can see there are multiple scores … | |
Hi everybody. What is the usage of `urljoin`? An example: >>> from urlparse import urljoin >>> url = urljoin('http://python.org/','about.html') >>> url 'http://python.org/about.html' I think the answer is that when we take a link from here `'http://www.python.org/` for example , it looks like this `<a href="/about/>about</a>`. So if i take the … | |
Well I done it! Got bored after the holidays and bought a Raspberry Pi credit card sized computer ($35), the least expensive LED TV and a Logitech wireless Keyboard/Mouse combo. The way I ordered the kit it cost almost twice as much, but it came with a good 2.5A powersupply, … | |
Hello. I'm trying to create a web crawler. I've read about web crawler's duty and about how it works and what he does. But just need more information. Could you please tell me what does a web crawler can do? What kind of duty i can define for my web … | |
One way to find the shortest distance between a series of surface (x, y) points is to let Python module itertools find the non-repeating combinations of point pairs. Now you can apply the Pythagoras' theorem to find all the distances and the minimum distance. | |
Hello, me again :) With this code: >>> from BeautifulSoup import BeautifulSoup >>> import urllib2 >>> url = urllib2.urlopen('http://www.python.org').read() >>> soup = BeautifulSoup(url) >>> links = soup('a') >>> print links A list of links printed into the terminal. I want to send the list into a text file, i tried … | |
hi, i have created a drug dispensing client to be used by a pharmacy shop as a project. i need to add a function that can tell whether a drug has expired in the database. Csv was used. any idea how i should go about it. Thanks | |
I am try to make a program that alows the user to input their username and password to recive a set of options. Right now the options are to look at a file or quit. In order to complete it I need to know how to turn of the visability … | |
Given a unicode string or file, what is the best way to find a short unicode string that is **not** a substring of the first one ? I want a working algorithm that avoids transforming the first string into a list of characters. My first idea is to choose a … | |
Well this is my basic code for my RPG, can I have help improving it? import cmd import json from rpg_data import * class RPG(cmd.Cmd): def do_n(self, line): try: Me.location = Me.location.exits["north"] except: print("You can't go north") def do_s(self, line): try: Me.location = Me.location.exits["south"] except: print("You can't go south") def … | |
Hi again. I want to create a robot or spider or crawler with python urllib. Still couldn't find any good tutorial. Any suggestion?! | |
Hi friends. With `datetime.datetime.now()` or `datetime.datetime.today()` i can get the current date (English calendar) for my program but what about if i want to get the current date (from Persian calendar) for my program; then what should i do? As my pc os date is set to English calendar so … |
The End.