这是我收到的错误:
-- Building for: NMake Makefiles
-- The C compiler identification is GNU 4.8.1
-- The CXX compiler identification is GNU 4.8.1
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_86068\fast"
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/--REDACTED--/CMakeFiles/CMakeTmp …Run Code Online (Sandbox Code Playgroud) 我有一个必须保持其数据类型固定的数组。但是,在追加语句之后,其数据类型会发生变化。如何在不更改数据类型的情况下附加值?
vertices = array([0.5, 0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.5, 0.0, 0.0, 1.0, 0.0,
0.0, -0.5, 0.0, 0.0, 0.5, 0.0], dtype=np.float32)
print(vertices.dtype)
vertices = append(vertices, [-0.5, 0.0, 0.0, 0.0, 0.0, 1.0])
print(vertices.dtype)
Run Code Online (Sandbox Code Playgroud)
输出:float32 float64
我将Python 3与PyOpenGL结合使用,我需要在空间中绘制单个点。我知道一个点没有体积,但是我不知道是否有一种简单的方法可以在某些坐标处绘制点/球。编辑:我在pygame和tkinter gui内使用opengl
我尝试了以下代码:
glEnable(GL_POINT_SMOOTH)
glBegin(GL_POINTS)
glColor3d(1, 1, 1)
glPointSize(200)
glVertex3d(1, 1, 1)
glEnd() # This throws an error
Run Code Online (Sandbox Code Playgroud)
错误:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Program Files (x86)\Python37-32\lib\tkinter\__init__.py", line 1702, in __call__
return self.func(*args)
File "C:/Users/reas/Desktop/Programación/Dibujo/Dibujo.py", line 65, in vista_alzado
glEnd()
File "C:\Program Files (x86)\Python37-32\lib\site-packages\OpenGL\latebind.py", line 61, in __call__
return self.wrapperFunction( self.baseFunction, *args, **named )
File "C:\Program Files (x86)\Python37-32\lib\site-packages\OpenGL\GL\exceptional.py", line 45, in glEnd
return baseFunction( )
File "C:\Program Files (x86)\Python37-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 409, in __call__
return …Run Code Online (Sandbox Code Playgroud) 如何使用小部件上的按键输入制作缩放效果?该小部件位于滚动区域内,并且有一些使用 QPainter 绘制的绘图会随着用户输入而变化。缩放会影响滚动条的长度,距离越近,滚动条越小。最小级别的缩放应该使滚动条与小部件区域一样大,这样小部件中的所有内容都可以可视化。
雷:
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QPainter, QPen, QColor
import sys
class Diedrico(QWidget):
def __init__(self, parent):
super().__init__(parent)
def paintEvent(self, event):
qp = QPainter(self)
qp.setPen(QPen(QColor(Qt.black), 5))
qp.drawRect(500, 500, 1000, 1000)
class UiVentana(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(UiVentana, self).__init__(parent)
self.resize(520, 520)
self.widget_central = QtWidgets.QWidget(self)
scrol = QtWidgets.QScrollArea(self.widget_central)
scrol.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
scrol.setGeometry(QtCore.QRect(10, 10, 500, 500))
scrol.setWidgetResizable(False)
contenido = QtWidgets.QWidget()
contenido.setGeometry(QtCore.QRect(0, 0, 2000, 2000))
scrol.setWidget(contenido)
self.Diedrico = Diedrico(contenido)
self.Diedrico.setGeometry(QtCore.QRect(0, 0, 2000, 2000))
self.setCentralWidget(self.widget_central) …Run Code Online (Sandbox Code Playgroud) 我有三个整数,我需要检查两个整数是否相等。我的代码很丑陋:
a = 5
b = 7
c = 5
if a == b or b == c or a == b:
pass
Run Code Online (Sandbox Code Playgroud)
我想知道是否有比这种比较更好的选择。