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)
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 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.
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 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 4 years ago.
Improve this question
I have the following python script that is no longer working. It ran when I first did this, but I ran it again after a few months of not touching it, and now I am getting the following error: ImportError: No module named mpl_toolkits.mplot3d
Like I said, I didn't edit anything in this script since it has worked months ago. I checked the import statements, and they seem to be correct. I'm not sure what is going on. I tried finding a solution online, but I was unsuccessful. I realize that this is a pretty hard question to answer, but I thought I would give it a shot. I am totally stumped. Thank you for any help you can give.
This script just makes a window pop up with a multi variable function plotted. What it does isn't really important though. I think I adapted it from a tutorial I found online.
#!/usr/bin/python
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import random
def fun(x, y):
return x**2 + y
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = y = np.arange(-3.0, 3.0, 0.05)
X, Y = np.meshgrid(x, y)
zs = np.array([fun(x,y) for x,y in zip(np.ravel(X), np.ravel(Y))])
Z = zs.reshape(X.shape)
ax.plot_surface(X, Y, Z)
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
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