Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
Attribute Error: partially initialized module 'turtle' has no attribute 'Turtle' (most likely due to a circular import)
starting code-->
import turtle
from turtle import *
s = Screen()
s.screensize(700, 1000)
speed(5)
def myPosition(x, y):
penup()
goto(x, y)
pendown()
pensize(2)
ending code-->
myshirt()
allhands()
mymouth()
alleyebrows()
alleyes()
ht()
input()
Assumption: Your file is named turtle.py. When you do import turtle, it tries to import itself. Try renaming it.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 hours ago.
Improve this question
I try executer in jupiter notebook and i didn't
import matplotlib.pyplot as plt
from math import *
from numpy import *
from pylab import *
t = arange(0.1, 20, 0.1)
y1 = sin(t)/t
y2 = sin(t)*exp(-t)
p1, p2 = plot(t, y1, t, y2)
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
When the button is pressed, I want the pictures in the selected folder path to be displayed at 1 second intervals. But the interface is not updated until the method I connected the button to finishes. What can I do?
def analyze_button_clicked(self):
for (root,dirs,files) in os.walk(self.input_output_tree.topLevelItem(0).text(0)):
for file in files:
if file.endswith(".jpg") or file.endswith(".jpeg"):
image_path = os.path.join(root, file)
pixmap = QPixmap(image_path)
self.process_image.setPixmap(pixmap)
It will likely update if you call QApplication.processEvents() after updating the Pixmap, like so:
from PyQt5.QtWidgets import *
def analyze_button_clicked(self):
for (root,dirs,files) in os.walk(self.input_output_tree.topLevelItem(0).text(0)):
for file in files:
if file.endswith(".jpg") or file.endswith(".jpeg"):
image_path = os.path.join(root, file)
pixmap = QPixmap(image_path)
self.process_image.setPixmap(pixmap)
QApplication.processEvents()
However, like Cristian said, it is advisable to use Signals & Slots
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
from tkinter import *
root = Tk()
mylabel = label(root, text = "What's up?")
mylabel.pack()
root.mainloop()
This is the code I used in Visual code studio. And it shows me an error:
NameError: name 'label' is not defined
What do I need to change to make this work?
pls change your code like this
mylabel = Label(root,text = '')
you should use Lable instead label
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I have just started to use kivy. Currently, I am watching videos on kivy and copying their code. I copied it but got an error while the dude in the video didnt. I am trying to make a moving Label and a textinput box.
This is my code:
b = BoxLayout()
t = TextInput
f = FloatLayout()
s = Scatter()
l = Label(text="hell0")
f.add_widget(s)
s.add_widget(l)
b.add_widget(f)
b.add_widget(t)
this is the error im getting:
TypeError: descriptor 'fbind' requires a 'kivy._event.EventDispatcher' object but received a 'str'
You are doing a t = TextInput which does not create a TextInput widget, so your b.add_widget(t) fails because t is not a widget. Just change t = TextInput to t = TextInput(). And if you are using GridLayout, you must specify either cols or rows in the call to GridLayout().
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm trying to get the caret position in Python. I tried using win32gui.GetCaretPos() but it always returns 0,0.
Do you have any ideas how to make it work?
Thanks
Chris
If the caret is in a window created by another thread, you need to call AttachThreadInput. Assuming you want the caret of the foreground window, you can get to it like this:
import win32gui
import win32process
import win32api
fg_win = win32gui.GetForegroundWindow()
fg_thread, fg_process = win32process.GetWindowThreadProcessId(fg_win)
current_thread = win32api.GetCurrentThreadId()
win32process.AttachThreadInput(current_thread, fg_thread, True)
try:
print win32gui.GetCaretPos()
finally:
win32process.AttachThreadInput(current_thread, fg_thread, False) #detach