15,190 Topics
![]() | |
import tkinter root = tkinter.Tk() root.geometry("200x200") buttons=[i for i in range(10)] def getNext(): #If specific button is pressed, output "YES" for num in buttons: btn=tkinter.Button(root, text=num,command=getNext) btn.pack(side=tkinter.TOP) | |
from tkinter import* import tkinter import sqlite3 import sys conn = sqlite3.connect('REVISION CARD.db') c=conn.cursor() def load(): root=Tk() root.title("REVION CARDS") root.geometry("700x400+100+100") w1=Label(root, text="Question") w1.pack() e=Entry(root,width=40) e.pack() w2=Label(root,text="Answer") w2.pack() e1=Entry(root,width=40) e1.pack() toolbar=Frame(root) navbar=Frame(root) N=Button(toolbar, text="next",width=9,command=getNext) N.pack(side=RIGHT, padx=200, pady=5) B=Button(toolbar, text="previous", width=9) B.pack(padx=100, pady=5) toolbar.pack(side=TOP, fill=X) count=IntVar() c.execute("SELECT * FROM topic") list1 = … | |
How to add some data where ever a empty line is present. for ex. between line 3 and line 4 below, we have a empty line and I want to add some stuff at that empty line location. how can i do it please help me. I am new to … | |
In [this page](https://uwsgi.readthedocs.io/en/latest/WSGIquickstart.html), the first example of using python with uwsgi is the following code: def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World"] As you can see, there is this `start_response` function which is provided by uwsgi, which is similar to all those things that framewroks like django provide … | |
I want to define a function like this: n_H = 0.9 # constant . x = np.array([16.7, 16.5, 16.1, 15, 13.5,14.2, 14.9, 13.7])# example to test D = np.array([0, 1, 4, 7, 16, 31, 64, 127]) Sec_nucli = [] x = [] D = [] Sec_nucli[i]= n_H *D[i]* x[i] where … | |
Hi. Sorry if the question is confusing or weird but I am trying to find a specific number of bytes after finding a different set of bytes. Hopefully with code and my explaination of code, i'll get my question across. import base64 find_bytes = bytearray(base64.b16decode('46726F4B6E6F')) with open("readfile.raw", "rb") as f: … | |
I am supposed to write a program that takes a person's whole name and returns the name's numerical value. The numerical value is found by the values of the letters in the name (with a=1, b=2...z=26). This is what I have so far: def main (): name = input("What is … | |
Hey how do you install pyHook with pip? pip installs everything for me but pyHook, when trying to install pyHook it says: Could not find a version that satisfies the requirement pyhook (from versions: ) No matching distribution found for pyhook How can i fix this? i have got windows … | |
I am trying to delete files in flask after they are downloaded, but I'm hung up on file path issues, generating empty excel files. The file that is downloaded is passed to the route for the file download from a session variable. The following code finds the file and downloads … | |
I want to associate a REST API end point to two urls, "manager" and "manager/". So I added two path entries in the urlpatterns with these urls. But it seems something that can be handled with some kind of configuration. Is there such a configuration with django? thanks | |
Hello, I am confused when we have array in python why should we use set or lists they work almost similarly right? and array are bit faster that lists. I am using numpy arrays but a friend of mine uses sets and lists. I am confused please explain what to … | |
Want to clear how to write a program to store the given telephone details in dictionary and print all the number whose name starts with e. Data =('Einstein':1234567896),('newton':2478965782),('Alexander':9876543216) | |
class subjectGradeBook(object): def __init__(self): self.grades={} def addStudents(self,name): self.grades[name]={} def reportGrade(self,name,subject,grade): k=self.grades[name] gradeList=k.setdefault(subject,[]) gradeList.append(grade) def averageGrade(self,name): k=self.grades[name] total,count=0,0 for grades in k.values(): total+=sum(k) count+=len(k) return total/count book = subjectGradeBook() book.addStudents('AlbertEinstein') book.reportGrade('AlbertEinstein', 'Math', 75) book.reportGrade('AlbertEinstein', 'Math', 65) book.reportGrade('AlbertEinstein', 'Gym', 90) book.reportGrade('AlbertEinstein', 'Gym', 95) book.averageGrade('AlbertEinstein') | |
I'm making a device that will display the weeks and days until a specific date (in this case my wifes maternity leave start). I am using a Raspberry Pi with a 4" screen. The plan is to use a python script to display full screen the weeks and days left … | |
I'm developing a GUI using wxPython (Boa Constructor IDE). My GUI has the following: Rich text control Start button Stop Button My requirement is that when I press the START button, numbers (1, 2, 3, etc.) should start printing in the text control; it should stop when I press the … | |
hi. i have a really basic question (really new to python). how do i read an entire binary file? from https://www.devdungeon.com/content/working-binary-data-python , `data = binary_file.read()` is to read the whole file at once. so i have a .dng file to test, which is 16.2mb, and i did: with open("portrait1.dng", "rb") … | |
I have a wx.DatePickerCtrl with the dropdown popup window that allows the user to pick a date from the calendar. What I would l like to have my program do is process an event when the user has clicked on a day in the dropdown calendar. Unfortunately the only native … | |
A person starts out as the "Curator" and stands at the end of a field. Everyone else playing stands at the far end (distance depends upon playing area selected). The object of the game is for a "Statue" to tag the Curator, thereby becoming the Curator and resetting the game. … | |
This is my custom module: [CODE]class Player(object): def __init__(self, name, score = 0): self.name = name self.score = score def __str__(self): rep = self.name + ":\t" + str(self.score) return rep def ask_yes_no(self, question): response = None while response not in ("y", "n"): response = input(question).lower() return response def ask_number(self, question, … | |
Hi. I have a .raw file and I want to display it as hex. why? because i want to try and replicate what 010 Editor can do which is read any sort of file and display in whatever format user desires (plus it can be used to edit and stuff) … | |
Hi, i am working on program that connect to database, and user then cans see, edit, insert and delete data in mysql database. I have problem whit update query, can somone help me whit this. User need to click on cell and enter/change data, then hit enter to save changes. … | |
Greetings I'm fairly new to python, and I know that this is possible but I'm having trouble with syntax: I'm reading a file from the command line and putting it's contents into a dictionary. Keys are repeated in the file, so the values must be placed within a list. In … | |
I want to make a game that allows users to make a log in which requires them to make a username and password,I will then give them an option whether they woul like to register or log in.This is where I am stuggling as I dont know how to save … | |
I'm jumping into Python/Django, and have been hitting some speed bumps. I'm a somewhat novice programmer. I know the basics, but haven't done anything more than create a PHP webform, and build very simple websites. I have a thousand questions about Django (most centering around Views and customizing the Admin, … | |
I have a file where I must find and delete a string, which in this case is called 'queue'. After I delete it, I must then delete all the following lines until a '[' character is found. I can't figure out how to do this, being a newbie in python … | |
Using the code in class Coin as a base write in a file and do the following 1. Create two coin objects coin1 and coin2 2. Demonstrate that they are both show() “Heads” 3. Demonstrate that if you turn() either of them they show “Tails” 4. Add a new member … | |
for example, i have this code def awal(): a = 2 def akhir(): print(a) awal() akhir() well i got error that said a is not defined? i used global, same error use return, same error any idea why? | |
Hello all, i need your help regaring this code, which is in python and i need to convert it into mips?? register $s0 holds the base address of list my_data, $s1 holds the length of the list my_data, register $s2 holds the base address of list my_data2 and $s3 holds … | |
Hello friends i want to create a database for Login system. Means i just need to create and connect the database to my python file and taking some data in that database from user. For example like signup login form but in system application. | |
I'm trying to run a project that uses Django and uWSGI in a Docker container. But I'm new to Docker and uWSGI so I'm not quite sure how I'm supposed to do it. At first I build the project with the below command: docker build -t saleor . Then I … |
The End.