I keep getting the error message "AttributeError: type object 'Tk' has no attribute 'tk' when trying to start my program. I have tried to change letters of the variable tk and changed the name of the file in order to make it work. I am working with both pygame and tkinter as I would like to put the pygame window in a tkinter environment instead. I have already tried this one, https://stackoverflow.com/questions/2331...thon-frame, though without any result. I used the code of that question to get my code to work.
import pygame
from tkinter import *
import tkinter as tk
from spelare import Paddle
from boll import Ball
from pygame import mixer
pygame.init()
root = tk.Tk
embed = tk.Frame(root, width = 500, height = 500) #creates embed frame for pygame window
embed.grid(columnspan = (600), rowspan = 500) # Adds grid
embed.pack(side = LEFT)
screen = pygame.display.set_mode((660,500))
screen.fill(pygame.Color(255,255,255))
pygame.display.init()
pygame.display.update()
pygame.display.set_caption("Pong Game")
Larz60+ write Feb-14-2022, 09:46 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBcode tags on future posts.
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBcode tags on future posts.
Attached Files
