Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Search results

  1. menator01

    Python issues when trying to pull from database using SQLite3

    Here is a example with flask and sqlite3. Hope it helps. app.py import sqlite3 from flask import Flask , render_template, url_for, request, redirect, session from database import Database app = Flask(__name__) app.secret_key = 'my secret key' @app.route('/') def index(): return...
  2. menator01

    Python issues when trying to pull from database using SQLite3

    Please post code instead of images. I would try and get the python part working first them implement the flask. A quick example import sqlite3 connect = sqlite3.connect('user.db') if connect: print(f'Connected to user.db') cursor = connect.cursor() def database(name, passwd): query =...
  3. menator01

    Random Quote

    Gets a random quote from internet. Tkinter and python import requests import json import tkinter as tk root = tk.Tk() root.title('Random quote of the day') def get_quote(): frame = tk.Frame(root) frame.grid(column=0, row=1, sticky='news', padx=1) url =...
  4. menator01

    Simple tkinter window using pygame sound mixer

    Simple tkinter window using images and pygame sound mixer. You will need to download or create a wav file and name it click.wav or edit accordingly. # Do the imports import tkinter as tk import pygame # Inialize pygame mixer pygame.mixer.init() root = tk.Tk() root.geometry('400x200+350+350')...
  5. menator01

    Color name and hex value from web

    Not posted in a while so, here is a quick tkinter app for getting a hex value for color. Enjoy. import tkinter as tk from tkinter import ttk from bs4 import BeautifulSoup import requests class Data: ''' Data queries the web for color hex and names from the web parses the page and...
  6. menator01

    Python I cannot slice Strings in a list

    You could do something like this alist = ['12345ham', '12345spam', '12345spammy'] alist = [item[5:] for item in alist] print(alist) I would recommend making a copy to do the changes.
  7. menator01

    Python 8 Pattern Horseracing

    Is there a question?
  8. menator01

    Python turtle problem

    I took your project a step further. The dog is a little big for the screen as it was what I was using to familiarize myself with turtle. I've not shrunk it down for the tkinter window. play.py import tkinter as tk import turtle import drawings class Window: def __init__(self, parent)...
  9. menator01

    Python turtle problem

    Or you could just change type here on this line change turtle.speed(penPace) to turtle.speed(int(penPace))
  10. menator01

    Python calculator works fine but after one operation its result is always 0

    You are probably right. I think it's good for a quick option for a variable with either a left or right (so to speak). I agree that my code is not really for beginners. I get carried away sometimes when I see the potential of some coding. It's also the first time i have tried customtkinter. I...
  11. menator01

    Python calculator works fine but after one operation its result is always 0

    Edited the script a little. Used MVC modal and did away with tkinter messagebox by creating a toplevel window. from decimal import Decimal import customtkinter as tk tk.set_appearance_mode('dark') class ErrorPage: ''' Class create a error page using a toplevel window. ''' def...
  12. menator01

    Python calculator works fine but after one operation its result is always 0

    I find it easier to go with classes. I was going to go with the MVC approach but, decided to just put the actions in a class. :).
  13. menator01

    Python calculator works fine but after one operation its result is always 0

    Here is my approach. I have bound the keys to enter input. Both the return key and keypad enter will calculate. The ESC key will clear. from decimal import Decimal import customtkinter as tk tk.set_appearance_mode('dark') class Calc: ''' Class for performing operations ''' def...
  14. menator01

    Python calculator works fine but after one operation its result is always 0

    It's probable line 57 and 58. You are setting them to zero. Try changing the vales of one or both and see what happens. I recommend that you find another way other than using global as well. It's line 41 resultNumber = 0
  15. menator01

    Simple pygame rain animation

    Little project was playing around with. You can download the image and sound files from github requires pillow # Do the imports import pygame import os from random import random, randint from PIL import Image # Initiate pygame pygame.init() # Path to executing script path =...
  16. menator01

    Happy New Years!

    Happy New year
  17. menator01

    Merry Christmas and Happy Holidays from Code Forum

    Merry Christmas to all.
  18. menator01

    PHP How do you fix image not found in database error

    Can you show the code?
  19. menator01

    Python Range / empty list issue??

    This line is where the error is. random_suit = randrange(0, len(available_cards)) There is no range between 0 and 0.
  20. menator01

    Python Range / empty list issue??

    I'm not sure if this is what you want but, If the pull is from an empty list, this will reset the deck. Added a try block in the while loop while True: try: generate_random_card() except ValueError: full_deck = {} for i in range(len(suits))...
Back
Top Bottom