用VS 运行 python 画图 ,画不出来,有一个告警

用VS 运行 python 画图 ,画不出来,有一个告警
图片说明图片说明

2个回答

控制台上本来就没法画,和那个警告无关。用jupyter notebook。

caozhy
贵阳老马马善福专门编写代码的老马就是我! 回复wangyifengandwangyou: 不管你用什么,控制台只能输出字符,怎么也没法画图。
大约一年之前 回复
wangyifengandwangyou
清风小溪 我用得是visual studio工具调试的 ,自动出现的控制台
大约一年之前 回复
caozhy
贵阳老马马善福专门编写代码的老马就是我! 回复wangyifengandwangyou: 怕麻烦的话,直接装anaconda https://download.csdn.net/download/caozhy/10513527
大约一年之前 回复
wangyifengandwangyou
清风小溪 notebook,换这个工具运行吗?
大约一年之前 回复

这代码应该就是我上次写给你的。我给出运行视频截图,当时你也看到了,在notebook上可以画。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
用Graphics画图时画不出来
代码: private Image DrawPic(IDictionary picList, IDictionary layerTypeList) rnrn Image backimg = null;//身体图片 rn Image bit = null; //中专图 rn //循环合成rn foreach (KeyValuePair item in layerTypeList) rn LayerType layerType = item.Value;rn if (layerType == null)rn continue;rn Image pic = picList[item.Key]; //得到相应坐标的图片或者文字rn if (pic == null)rn continue;rn if (item.Key == "body") rn backimg = pic;rn continue;rn rnrn #region 背景与其他图片合成rn bit = pic;rn [color=#FF0000] Graphics gh = Graphics.FromImage(backimg);[/color] rn gh.DrawImage(bit, layerType.X, layerType.Y, layerType.Width, layerType.Height);rn gh.Dispose();rn #endregionrn rn return backimg;rn rnrn执行到红色字体的时候, 就直接蹦出窗体了, 也不报错。 是什么原因
gdi+ 半透明画刷画图为什么画不出来?
我想在鼠标指针下边画一个半透明的圆,鼠标位置通过ci得到了 可是没有画出来 为什么呢(hMemDc没有问题,鼠标本身就被画进去了) rnint x0=ci.ptScreenPos.x - ii.xHotspot-40; rnint y0=ci.ptScreenPos.y-ii.yHotspot-40; rnint x1=ci.ptScreenPos.x - ii.xHotspot+40; rn int y1=ci.ptScreenPos.y-ii.yHotspot+40; rnint rheight=y1-y0; rnint rwide=x1-x0; rnRect myrect(x0,y0,rwide,rheight); rnLinearGradientBrush myLinearGradientBrush( myrect, Color(255, 0, 0, 255), Color(255, 0, 255, 0), LinearGradientModeHorizontal); rnrnGraphics mygraphics(hMemDC); rnrnmygraphics.FillEllipse(&myLinearGradientBrush,x0,y0,rwide,rheight);
【求助】这个简单的画图程序画不出来
下面这个程序不知道为什么画不出来。求指教,谢谢!rnrn[code=Java]rnimport javax.swing.*;rnimport java.awt.BorderLayout;rnimport java.awt.Color;rnimport java.awt.Component;rnimport java.awt.Graphics;rnimport java.awt.HeadlessException;rnimport java.awt.event.HierarchyEvent;rnimport java.awt.event.HierarchyListener;rnimport java.awt.event.MouseAdapter;rnimport java.awt.event.MouseEvent;rnimport java.awt.image.BufferedImage;rnrn/**rn * 简单的 Java 铅笔rn */rnpublic class JPencil extends JFrame rnrn // 程序执行入口rn public static void main(String[] args) throws Exception rn try rn UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());rn catch (Exception e) rn e.printStackTrace();rn rnrn new JPencil("JPencil").setVisible(true);rn rnrn public JPencil(String title) throws HeadlessException rn super(title);rn setupWindow();rn setupControls();rn rnrn private void setupControls() rn this.setLayout(new BorderLayout());rnrn final DrawPanel drawPanel = new DrawPanel();rn this.add(drawPanel, BorderLayout.CENTER);rnrn final JPencil jPencil = this;rnrn // 当窗口打开的时候初始化 drawPanel(否则无法获取 width 和 height)rn this.addHierarchyListener(new HierarchyListener() rnrn public void hierarchyChanged(HierarchyEvent e) rn boolean isShowingUp = jPencil.isVisible() &&rn e.getChangeFlags() == HierarchyEvent.SHOWING_CHANGED;rnrn if (isShowingUp) rn drawPanel.init();rn rn rn );rn rnrn private void setupWindow() rn this.setDefaultCloseOperation(EXIT_ON_CLOSE);rn this.setResizable(false);rn this.setSize(800, 600);rn this.setLocation(50, 50);rn rnrn /////////////////////////////////////////rnrn /**rn * 绘图板rn */rn private class DrawPanel extends JPanel rnrn private BufferedImage image; // 缓存 Image 对象rnrn private Pencil pencil;rnrn public void init() rn this.image = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);rn this.pencil = new Pencil(this, this.image);rn rnrn @Overridern protected void paintComponent(Graphics g) rn super.paintComponent(g);rn g.drawImage(this.image, 0, 0, null); // 在这里绘图rn rn rnrn /////////////////////////////////////////rnrn /**rn * 铅笔工具rn */rn private class Pencil extends MouseAdapter rnrn private BufferedImage image;rnrn private Component component;rnrn private int lastX = -1, lastY = -1;rnrn /**rn * 构造函数rn *rn * @param component 可绘图的 Component 对象rn * @param image 要绘制的 Image 对象rn */rn public Pencil(Component component, BufferedImage image) rn this.image = image;rn this.component = component;rn this.clear();rnrn component.addMouseListener(this); // MouseListener 负责处理鼠标键按下和松开事件rn component.addMouseMotionListener(this); // MouseMotionListener 负责处理鼠标拖拽事件rn rnrn private void clear() rn this.image.getGraphics().setColor(Color.white);rn this.image.getGraphics().fillRect(0, 0, getWidth(), getHeight());rn this.image.getGraphics().setColor(Color.black);rn rnrn private void draw(int x, int y) rn this.image.getGraphics().drawLine(lastX, lastY, x, y);rn this.component.repaint();rn rnrn @Overridern public void mouseDragged(MouseEvent e) rn if (this.lastX != -1 && this.lastY != -1) rn draw(e.getX(), e.getY());rn rnrn this.lastX = e.getX();rn this.lastY = e.getY();rn rnrn @Overridern public void mousePressed(MouseEvent e) rn // 设置绘图的起始点rn this.lastX = e.getX();rn this.lastY = e.getY();rn rnrn @Overridern public void mouseReleased(MouseEvent e) rn // 结束绘图rn this.lastX = -1;rn this.lastY = -1;rn rn rnrn[/code]
用vfw 写视频会议 ,但是画图 画不出来
我用vfw 写的一个视频会议rn参照前人的一些代码rn但是 我的 DrawDibDraw 这个函数 貌似一直不管用,都不将数据 画到 bitmap 中去rn客户端得到的图片都是空白的 rn代码如下 : rnrn客户端rnDrawDibDrawrnunit Unit1;rnrninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,rn Dialogs, StdCtrls, ExtCtrls, VFW, IdBaseComponent, IdComponent, IdUDPBase,rn IdUDPClient, jpeg, pngimage;rnrntypern TForm1 = class(TForm)rn pnl1: TPanel;rn btn1: TButton;rn btn2: TButton;rn IdUDPClient1: TIdUDPClient;rn mmo1: TMemo;rn btn3: TButton;rn procedure btn1Click(Sender: TObject);rn procedure btn2Click(Sender: TObject);rn procedure btn3Click(Sender: TObject);rn privatern Private declarations rn publicrn Public declarations rn end;rnrnvarrn Form1: TForm1;rnrn CapWnd: THandle; //定义捕捉窗句柄rn CapParms: TcaptureParms; //用于设置设备属性的结构变量rn BMPINFO: TBitmapInfo; //BMP图像信息rn lpVHdr: PVIDEOHDR;rn rnimplementationrnrn$R *.dfmrnconst WM_CAP_START = WM_USER;rnconst WM_CAP_STOP = WM_CAP_START + 68;rnconst WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;rnconst WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;rnconst WM_CAP_SAVEDIB = WM_CAP_START + 25;rnconst WM_CAP_GRAB_FRAME = WM_CAP_START + 60;rnconst WM_CAP_SEQUENCE = WM_CAP_START + 62;rnconst WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;rnconst WM_CAP_SEQUENCE_NOFILE =WM_CAP_START+ 63 ;rnconst WM_CAP_SET_OVERLAY =WM_CAP_START+ 51 ;rnconst WM_CAP_SET_PREVIEW =WM_CAP_START+ 50 ;rnconst WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START +6;rnconst WM_CAP_SET_CALLBACK_ERROR=WM_CAP_START +2;rnconst WM_CAP_SET_CALLBACK_STATUSA= WM_CAP_START +3;rnconst WM_CAP_SET_CALLBACK_FRAME= WM_CAP_START +5;rnconst WM_CAP_SET_SCALE=WM_CAP_START+ 53 ;rnconst WM_CAP_SET_PREVIEWRATE=WM_CAP_START+ 52 ;rnfunction FrameCallBack(hWnd: HWND; lpVHdr: PVIDEOHDR): DWORD; stdcall;rnvarrn hd: THandle;rn jpg: TJpegImage;rn memStream: TMemoryStream;rn Bitmap: TBitmap;rn png: TPNGObject;rn mystream: TMemoryStream;rn i: Integer;rnrnbegin //将数据显在Image,rnrn Bitmap := TBitmap.Create;rn // New size of Bitmaprn hd := DrawDibOpen;rn DrawDibDraw(hd, Bitmap.Canvas.Handle, 0, 0, BMPINFO.BmiHeader.biwidth,rn BMPINFO.bmiheader.biheight, @BMPINFO.bmiHeader, lpVHdr^.lpData, 0, 0,rn BMPINFO.bmiHeader.biWidth, BMPINFO.bmiHeader.biheight, 0);rn DrawDibClose(hd);rn //发送数据rn memStream := TMemoryStream.Create;rn jpg := TJpegImage.Create;rn jpg.Assign(Bitmap);rn jpg.CompressionQuality :=15;rn //jpg压缩质量rn jpg.JPEGNeeded;rn jpg.Compress;rn jpg.SaveToStream(memStream);rn jpg.Free;rn //因为UDP数据包有大小限制,这里如果超出部分,就没有传输,完全可以发几次发出去rn Form1.IdUDPClient1.BroadcastEnabled := true; //用广播功能rn if memStream.Size > Form1.IdUDPClient1.BufferSize thenrn Form1.IdUDPClient1.SendBuffer('192.168.1.255', 9001, memStream.Memory^, Form1.IdUDPClient1.BufferSize) //向192.168.0.X网段广播,端口 9001rn elsern Form1.IdUDPClient1.SendBuffer('192.168.1.255', 9001, memStream.Memory^, memStream.Size);rn memStream.Free;rn Bitmap.Free;rn if FileExists('abc' + '.bmp') thenrn beginrn DeleteFile('abc' + '.bmp');rn end;rnend;rnrnprocedure TForm1.btn1Click(Sender: TObject);rnbeginrn CapWnd := capCreateCaptureWindow('我的窗口', WS_VISIBLE or WS_CHILD, //窗口样式rn 0, //X坐标rn 0, //Y坐标rn pnl1.Width, //窗口宽rn pnl1.Height, //窗口高rn pnl1.handle, //窗口句柄rn 0); //通常为0rn if CapWnd = 0 then exit; //定义帧捕捉回调函数rn CapSetCallbackOnFrame(CapWnd, FrameCallBack);rn BMPINFO.bmiHeader.biWidth := 500;rn BMPINFO.bmiHeader.biHeight:= 600;rn CapParms.dwRequestMicroSecPerFrame := 1;rn CapParms.fLimitEnabled := FALSE;rn CapParms.fCaptureAudio := FALSE;rn CapParms.fMCIControl := FALSE;rn CapParms.fYield := TRUE;rn CapParms.vKeyAbort := VK_ESCAPE;rn CapParms.fAbortLeftMouse := False;rn CapParms.fAbortRightMouse := FALSE; //让设置生效rn CapCaptureSetSetup(capWnd, @CapParms, sizeof(TCAPTUREPARMS));rn CapPreviewRate(capWnd, 33); //设置预览视频的频率rn CapCaptureSequenceNoFile(capWnd); //如果要捕捉视频流,则要使用函数来指定不生成文件,不然会自动生成AVI文件rn CapDriverConnect(CapWnd, 0); //连接摄像头设备,第二个参数是个序号,当系统中装有多个显示驱动程序时,其值分别依次为0到总个数如果有多个摄像头,那么就是0->1->2 capGetVideoFormat(capWnd, @BMPINFO,sizeof(TBitmapInfo)); //取得视频图像数据头rn CapPreviewScale(capWnd, TRUE); //是否缩放rn CapOverlay(capWnd, true); //指定是否使用叠加模式,true为使用,否则为falsern CapPreview(capWnd, true);rnrnrnend;rnrnprocedure TForm1.btn2Click(Sender: TObject);rnbeginrn capCaptureAbort(CapWnd); //停止捕捉rn capDriverDisconnect(CapWnd); //将捕捉窗同驱动器断开rnrnend;rnrnprocedure TForm1.btn3Click(Sender: TObject);rnbeginrn //mmo1.Lines.Add(vstr);rnend;rnrnend.rnrnrn客户端 : rnunit Unit1;rnrninterfacernrnusesrn Windows, Messages, SysUtils, Variants, Classes,rn Graphics, Controls, Forms, Dialogs, StdCtrls,rn IdBaseComponent, IdComponent, IdUDPBase, IdUDPServer, ExtCtrls, jpeg,rn IdSocketHandle;rnrntypern TForm1 = class(TForm)rn img1: TImage;rn idpsrvr1: TIdUDPServer;rn btn1: TButton;rn pnl1: TPanel;rn procedure idpsrvr1UDPRead(Sender: TObject; AData: TStream;rn ABinding: TIdSocketHandle);rn procedure btn1Click(Sender: TObject);rn procedure FormCreate(Sender: TObject);rn privatern Private declarations rn publicrn Public declarations rn end;rnrnvarrn Form1: TForm1;rnrnimplementationrnrn$R *.dfmrnrnprocedure TForm1.idpsrvr1UDPRead(Sender: TObject; AData: TStream;rn ABinding: TIdSocketHandle);rn var jpg: TJpegImage;rn j : Integer;rnbeginrnrn beginrn tryrn jpg := TJpegImage.Create;rn jpg.LoadFromStream(Adata);rnrn img1.Picture.Graphic := jpg;rnrn jpg.Free;rn exceptrn end;rnrnend;rnend;rnprocedure TForm1.btn1Click(Sender: TObject);rnbeginrnidpsrvr1.DefaultPort := 9001; //接收端口rnidpsrvr1.Active := true; //启用rnrnend;rnrnprocedure TForm1.FormCreate(Sender: TObject);rnbeginrn img1.Parent := pnl1;rnrnrnend;rnrnend.rnrn
一个JAVA画图问题,谁能帮我看看为什么画不出来?
一个JAVA画图问题,谁能帮我看看为什么画不出矩形,会不会是颜色的原因?rnrn代码如下:abc。javarnrnimport java.awt.*;rnimport java.awt.event.*;rnimport java.lang.Math;rnimport java.applet.Applet;rnpublic class abc extends Applet implements MouseListener rnboolean bMouseDownFlag=false;rnboolean bMouseUpFlag=false;rnPoint ptAnchor,ptDrawTo;rnpublic void mousePressed(MouseEvent e)rnbMouseDownFlag=true;rnbMouseUpFlag=false;rnptAnchor=new Point(e.getX(),e.getY());rnrnpublic void mouseReleased(MouseEvent e)rnbMouseDownFlag=false;rnbMouseUpFlag=true;rnptDrawTo=new Point(Math.max(e.getX(),ptAnchor.x),Math.max(e.getY(),ptAnchor.y));rnptAnchor=new Point(Math.max(e.getX(),ptAnchor.x),Math.max(e.getY(),ptAnchor.y));rnrepaint();rnrnpublic void mouseClicked(MouseEvent e)rnpublic void mouseEntered(MouseEvent e)rnpublic void mouseExited(MouseEvent e)rnpublic void paint(Graphics g)rnint drawWidth,drawHeight;rnif(bMouseUpFlag)rndrawWidth=ptDrawTo.x-ptAnchor.x;rndrawHeight=ptDrawTo.y-ptAnchor.y;rng.drawRect(ptAnchor.x,ptAnchor.y,drawWidth,drawHeight);rnrnrn
用python画一个心
想要研究可视化数据的python初学者。嘻嘻,小尝试。一颗小心心import matplotlib.pyplot as plt from matplotlib import animation import numpy as np import math t = np.linspace(0, math.pi, 1000) x = np.sin(t) y = np.cos(t)...
用python画一个菱形
用python画一个菱形,*星号填充 类似于 * *** ***** ******* ***** *** * 思路: 1:第一行一个,给一个变量a; 2:第一行前面有b个空格; 3:打印print(空格+*星号) 实现: #实现7行的菱形 for i in range(1,8,2): #由于每一行有奇数个,所以每次加2,步进为...
C#画图用owc画,
在网上找到了一些,不过自己弄总是不好用,谢谢大侠帮忙搞定一个,
Java画图(画一个时钟)
Java画图(画一个时钟)~Java画图(画一个时钟)~Java画图(画一个时钟)~Java画图(画一个时钟)~
python 用 for 循环 画图
正方形 num = 6 for i in range(num): print("* " * num) 树 num = 7 for i in range(1,num): print(" "*(num-i) + "* "*i) for i in range(1,num): print(" "*(num-i) + "* "*i) for i in range(1,num): ...
用python画图(简单)
分享一个自己的简单图形,利用python语言,简单易学。
用python画图第一篇
用python画图,y=x和y=x*x叠加在一起。并且标记x=1的点 # -*- coding: UTF-8 -*- import matplotlib as mpl import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.pyplot as pl
这个程序怎么画不出来图 但是可以运行 高手指点 是一个简单的画图程序
在画布上绘制个矩形通过在文本框里 输入宽高以及左上顶点的坐标 按确认按钮 画图 rnimport java.applet.Applet;rnimport java.awt.Button;rnimport java.awt.Canvas;rnimport java.awt.Color;rnimport java.awt.Graphics;rnimport java.awt.Label;rnimport java.awt.TextField;rnimport java.awt.event.ActionEvent;rnimport java.awt.event.ActionListener;rnrnrnrn class Mycanvas extends Canvasrn rn int x,y;rn int w,high;rn int red,green,blue;rn Mycanvas()rn rn setSize(100,100);rn setBackground(Color.red);rn rn public void setX(int x)rn rn this.x=x;rn rn rn public void setY(int y)rn rn this.y=y;rn rn public void setW(int w)rn rn this.w=w;rn rn public void setHIGH(int high)rn rn this.high=high;rn rn public void paint(Graphics g)rn rn g.drawRect(x, y,w, high);rn rn rn rn rn rnrn rnrnpublic class Example5 extends Applet implements ActionListenerrnrn Mycanvas canvas;rn TextField text1,text2,text3,text4;rn Button b;rn Label label1,label2,label3;rn public void init()rn canvas=new Mycanvas();rn label1=new Label("请输入定点坐标:");rn text1=new TextField(6);rn text2=new TextField(6);rn label2=new Label("输入宽:");rn rn text3=new TextField(6);rn label3=new Label("请输入高:");rn text4=new TextField(6);rn add(label1);add(text1);add(text2);rn add(label2);add(text3);add(label3);add(text4);rn b=new Button("确定");rn b.addActionListener(this);rn add(b);rn add(canvas);rn rn rn public void actionPerformed(ActionEvent e)rn rn int x,y,w,high; rn if(e.getSource()==b)rn rn tryrn x=Integer.parseInt(text1.getText());rn y=Integer.parseInt(text2.getText());rn w=Integer.parseInt(text3.getText());rn high=Integer.parseInt(text4.getText());rn canvas.setX(x);rn canvas.setY(y);rn canvas.setW(w);rn canvas.setHIGH(high);rn canvas.repaint();rn rn catch(NumberFormatException ee)rn rn x=0;y=0;w=0;high=0;rn rn rn rn rn rn rnrnrnrn另外在Eclipse运行后小程序启动了 但是按确认时你能作图rnrnEclipse 显示 错误为rnException in thread "AWT-EventQueue-1" java.lang.NoSuchMethodError: Mycanvas.setL(I)Vrn at Example5.actionPerformed(Example5.java:87)rn at java.awt.Button.processActionEvent(Unknown Source)rn at java.awt.Button.processEvent(Unknown Source)rn at java.awt.Component.dispatchEventImpl(Unknown Source)rn at java.awt.Component.dispatchEvent(Unknown Source)rn at java.awt.EventQueue.dispatchEvent(Unknown Source)rn at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)rn at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)rn at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)rn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rn at java.awt.EventDispatchThread.pumpEvents(Unknown Source)rn at java.awt.EventDispatchThread.run(Unknown Source)rnrn
在VS下如何运行C的画图程序
#include "graphics.h"rnmain()rnint driver,mode,i;rnfloat j=1,k=1;rndriver=VGA;mode=VGAHI;rninitgraph(&driver,&mode,"");rnsetbkcolor(YELLOW);rnfor(i=0;i<=25;i++)rnrnsetcolor(8);rncircle(310,250,k);rnk=k+j;rnj=j+0.3;rnrn rn这个是C的画圆程序,如何在VS上正确调试运行呢,请教高手回答。
Linux基础(day74)
2019独角兽企业重金招聘Python工程师标准&gt;&gt;&gt; ...
GDI画字符串 画不出来
[code=csharp]private void button1_Click(object sender, EventArgs e)rn rn Bitmap bm = new Bitmap(200, 200);rn Graphics g = Graphics.FromImage(bm);rn g.Clear(Color.Black);rn g.DrawString("asdwqeqr", new Font("宋体", 14), new SolidBrush(Color.Blue), 20, 10);rn [/code] rn为什么那个字符串画不出来啊
告警系统邮件引擎 运行告警系统
1, mail.sh内容。 //其中mail.py内容到这里下载https://coding.net/u/aminglinux/p/aminglinux-book/git/blob/master/D22Z/mail.py log=$1 t_s=`date +%s` t_s2=`date -d &quot;2 hours ago&quot; +%s` if [ ! -f /tmp/$log ] then     ech...
运行不出来,哪里有问题?
#include rn#include rn#include rn#include rn#include rnrn// student's functionrnint count_student(char *str, char ch, int *count);rnrnrn// student's functionrnint count_student(char *str, char ch, int *count)rnrn int i;rn int j;rn int sum;rn char temp;rnrn i = 0;rn j = 0;rn sum = 0;rn // if string is nullrn if(str == NULL)rn *count = -1rn return 1;rn rnrn // string interceptionrn for(i=0;i
画图,显示不出来
一个对话框类响应OnPaintrn但在对话框出现的时候并没看到图形,F5发现一开始能进入这里但界面就是显示不出来rnrnCClientDC dc(this);rn CRect rectnew;rn GetDlgItem(IDC_PICTURE)->GetWindowRect(rectnew);rn ScreenToClient(&rectnew);rn dc.MoveTo(rectnew.TopLeft());rn dc.LineTo(rectnew.BottomRight());
用Python画五星红旗
此文首发于公众号「Python知识圈」,欢迎直接去公众号看。阅读文本大概需要 5 分钟。pk哥是篮球迷,上周六看了一场亚运会男篮决赛,中国队 VS 伊朗队,篮协主席姚明坐在场下坐镇,上半场中国队在次节最多落后 16 分的情况下,下半场上演逆转高潮,最终他们以 84-72 战胜伊朗男篮,时隔八年再夺亚运会男篮金牌的同时也成功报四年前仁川亚运会失利的一箭之仇。比赛结束那一刻,看到队员们披着国旗庆祝,真...
用Python画ROC曲线
开发十年,就只剩下这套Java开发体系了 &amp;gt;&amp;gt;&amp;gt;    ...
用Python画向日葵
import turtle turtle.setup(800, 800, 200, 200) turtle.pencolor(&amp;quot;yellow&amp;quot;) turtle.pensize(4) turtle.penup() turtle.fd(-150) turtle.pendown() for i in range(18): turtle.fd(300) turtl...
用python画条形图
在做毕设的过程中有些数据用表格来展现,会很难看出数据之间的差别,凸显不出数据的特点,所以想制作一个条形图,这里特地记录下,已备以后用到,这两张图对我这种小菜鸟来说可是花了一天的时间啊。。。。 import numpy as np import matplotlib.pyplot as plt import matplotlib #指定默认字体 matplotlib.rcParams['font.s...
用python画心
用python的turtle画一个心形,可以用来表白小姐姐~需要的随意下载~
用python画值日表
目的:学习通过python的PIL库来做图片的绘制,帮助熟悉Image,ImageDraw,ImageFont的使用第一部分,需要用到的函数封装1、取星期几:days=[ '星期一', '星期二', '星期三', '星期四', '星期五', '星期六','星期日'] def WeekDayName(day=datetime.datetime.weekday(datetime.datetime.no...
用Python画折线图
from numpy.random import randnimport matplotlib.pyplot as pltplt.style.use('ggplot')     #输入Y1值,定义X1的范围y1 = [0.8,0.4,0.2,0.1,0.05,0.025,0.0125,0.00625,0.0031,0.0016]x1 = range(0,10)fig = plt.figure()a...
用python画佩奇
用python绘制小猪佩奇的脸,代码量也不是很多,无聊可以自己参照前面的接着画佩奇的身子,hhh我是懒不想去弄了。
python画图程序(画红心和其他)
python画图程序,画红心和其他的图案,还有桌面显示的代码。
怎么画不出来。
我在dialog 的 button 中写入下列代码。但没有画出来。rn CRect l;rn l.left=0;rn l.top=0;rn l.right=90;rn l.bottom=90;rnrn CDC *dc=this->GetDC();rn CDC memdc;rn CBrush brBackground(RGB(34,0,196));rnrn memdc.CreateCompatibleDC(dc);rn memdc.FillRect(l, &brBackground);rnrn dc->BitBlt(0,0,90,90,&memdc,0,0,SRCCOPY);rn rn ReleaseDC(dc);rn ReleaseDC(&memdc);rn
为什么还是画不出来
Bitmap bm=new Bitmap(200,200); rn Pen blackPen = new Pen(Color.Black, 6);rn Graphics g=Graphics.FromImage(bm);rn g.DrawEllipse(blackPen, 1,1,100,100);rn
画图工具画不出来,求教!
/************************************************************************************************************/rnpublic class DrawMain extends JFramern //Main Methodrn public static void main(String[] args) rn J_ButtonPanel btPanel = new J_ButtonPanel();rn J_PaintingGround ptGround = new J_PaintingGround(btPanel);rn DrawMain app = new DrawMain(btPanel, ptGround);rnrn app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);rn app.setSize(600, 600);rn app.setVisible(true);rn rn //设置显示外观rn tryrn UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());rn catch(Exception e) rn e.printStackTrace();rn rn rn rn //构造函数rn public DrawMain(J_ButtonPanel btPanel, J_PaintingGround ptGround) rn //设置容器及容器的整体布局rn super("画板例程");rn Container cp = getContentPane();rnrn cp.add(btPanel.getPanel(),BorderLayout.WEST);rn cp.add(ptGround, BorderLayout.CENTER);rn rnrn/************************************************************************************************************/rnpublic class J_ButtonPanel extends JPanel implements ActionListenerrn private int optype = 0; //操作类型变量,默认值为0rn private JPanel buttonPanel = new JPanel(); //按钮版rn public JPanel getPanel()return buttonPanel; //获取按钮版rn public int getOptype()return optype; //获取操作类型rn J_ButtonPanel() rn //新建按钮rn btFree = new JButton("随手画");rn btLine = new JButton("直线");rn btRectangle = new JButton("矩形");rn btRound = new JButton("圆");rn btEllipse = new JButton("椭圆");rn btFill = new JButton("填充");rn btSave = new JButton("保存");rn btOpen = new JButton("打开");rn //添加按钮rn buttonPanel.add(btOpen);rn buttonPanel.add(btSave);rn buttonPanel.add(btFree);rn buttonPanel.add(btLine);rn buttonPanel.add(btRectangle);rn buttonPanel.add(btRound);rn buttonPanel.add(btEllipse);rn buttonPanel.add(btFill);rn rnrn public void actionPerformed(ActionEvent event) //鼠标监听器rn Object source = event.getSource(); //获取动作,确定操作类型rn if(source == btFree) optype = 0;rn if(source == btLine) optype = 1;rn if(source == btRectangle) optype = 2;rn if(source == btRound) optype = 3;rn if(source == btEllipse) optype = 4;rn if(source == btFill) optype = 5;rn if(source == btOpen) optype = 6;rn if(source == btSave) optype = 7;rn rnrn private JButton btFree;rn private JButton btLine;rn private JButton btRectangle;rn private JButton btRound;rn private JButton btEllipse;rn private JButton btFill;rn private JButton btSave;rn private JButton btOpen;rnrn/************************************************************************************************************/rnpublic class J_PaintingGround extends JPanelrn public Vector> m_vectorSet = new Vector>(); //设置变量存放笔画rn rn public J_PaintingGround(J_ButtonPanel buttonpanel) //构造函数rn btPanel = buttonpanel; //按钮版rn rn if(btPanel.getOptype() == 0)rn addMouseListener(new MouseAdapter()rn rn public void mousePressed(MouseEvent event)rn rn Vector v = new Vector();rn v.add(btPanel.getOptype());rn v.add(event.getX());rn v.add(event.getY());rn m_vectorSet.add(v);rn rn rn );rn addMouseMotionListener(new MouseMotionListener()rn rn public void mouseMoved(MouseEvent event)rnrn public void mouseDragged(MouseEvent event)rn rn int n = m_vectorSet.size()-1;rn Vector v = new Vector();rn v = m_vectorSet.get(n);rn v.add(event.getX());rn v.add(event.getY());rn repaint();rn rn rn );rn rn if(btPanel.getOptype() >=1 && btPanel.getOptype() <= 4)rn addMouseListener(new MouseAdapter()rn rn Vector v = new Vector();rn public void mousePressed(MouseEvent event)rn rn v.add(btPanel.getOptype());rn v.add(event.getX());rn v.add(event.getY());rn rn public void mouseReleased(MouseEvent event)rn rn v.add(event.getX());rn v.add(event.getY());rn m_vectorSet.add(v);rn repaint();rn rn rn );rn rn if(btPanel.getOptype() == 5)rn if(btPanel.getOptype() == 7)rn tryrn rn FileOutputStream f = new FileOutputStream("绘画作品.txt");rn DataOutputStream fout = new DataOutputStream(f);rn int i,j,m;rn int n = m_vectorSet.size();rn Vector vv = new Vector();rn for(i=0;i v = new Vector();rn Vector vv = new Vector();rnrn for(i=0;i();rn rn else rn f.seek(i*4);rn vv.add(f.readInt());rn rn rn this.repaint();rn rn catch(Exception e)rn rn System.err.println("发生异常:" + e);rn e.printStackTrace();rn rn rn rnrn protected void paintComponent(Graphics g)rn rn g.setColor(Color.YELLOW);rn g.clearRect(0, 0, getWidth(), getHeight());rn Vector v = new Vector();rn Point s, t;rn int i, j, m;rn int n = m_vectorSet.size();rn for(i=0,j=0; i
python 发送告警邮件
经常会遇到人不在程序面前,程序抛出异常时却没法及时处理时,可以通过如下的程序,发送一封告警邮件。 from smtplib import SMTP from email.mime.text import MIMEText from email.header import Header def send_email(SMTP_host, from_addr, password, to_addrs,...
用C#画图,跟画图版差不多
分类的思想,没有多余的代码,打开就能用,仔细阅读对编写图形文件很有好处。
用java画图如何画一个点?
如题
分隔符为什么画不出来?
我在学菜单这一章时,为什么按照书上的样子制分隔符时,在菜单里出现的是下划线,而不是分隔线,这是怎么回事呢。
canvas.drawPath无效,画不出来
canvas.drawPath无效 需要关闭手机的硬件加速 1.在自定义view中 加入 setLayerType(View.LAYER_TYPE_SOFTWARE, null); 2.在清单文件中 ,activity 或者application 中添加 android:hardwareAccelerated="false"
界面画不出来图形
我声明了一个CDC*类变量pBkDc,然后在Onpaint跑以下代码,然后dc.BitBlt SRCCOPY.但无法显示所要的图形。这是为什么呢?rn[code=c]rn CRect rect;rn CClientDC nDC(this);rn CBrush nBrush(RGB(255, 255, 255));rn CPen nPenBk;rn int cx_step, cy_step;rnrn GetClientRect(&rect);rn if (pBkDc->GetSafeHdc() == NULL)rn rn pBkDc->CreateCompatibleDC(&nDC);rn nBkBmp.CreateCompatibleBitmap(&nDC, rect.Width(), rect.Height());rn pBkDc->FillRect(rect, RGB(0, 0, 0));rn rnrn cx_step = rect.Width() /10;rn cy_step = rect.Height() / 10;rnrn if (pBkDc->GetSafeHdc() != NULL)rn rn nPenBk.CreatePen(PS_SOLID, 0, RGB( 150, 150, 50));rn CPen* pOldPen = pBkDc->SelectObject(&nPenBk);rnrn for (int i = 1; i < 10; i ++)rn rn pBkDc->MoveTo(cx_step * i, rect.top);rn pBkDc->LineTo(cx_step * i,rect.bottom);rn pBkDc->MoveTo(rect.left, cy_step * i);rn pBkDc->LineTo(rect.right, cy_step * i);rn rnrn pBkDc->SelectObject(&nBrush);rn pBkDc->DrawEdge(rect, EDGE_BUMP, BF_RECT);rn pBkDc->SelectObject(pOldPen);rn rn[/code]
怎么我用D3D的索引来画三角形画不出来
//顶点缓存和索引缓存的创建和填充rnrnrnHRESULT InitGriphics()rnrn //创建纹理对象rn if( FAILED( D3DXCreateTextureFromFile( g_pd3dDevice, L"texture.jpg", &g_pTexture ) ) )rn rn MessageBox(NULL, L"创建纹理失败", L"Texture.exe", MB_OK);rn return E_FAIL;rn rnrn //顶点数据rn CUSTOMVERTEX g_Vertices[] =rn rn 0, 0, 0.0f, 0.5f, 0.5f, rn -3, 3, 0.0f, 0.0f, 0.0f, rn 0, 3, 0.0f, 0.5f, 0.0f, rn 3, 3, 0.0f, 1.0f, 0.0f, rn 3, 0, 0.0f, 1.0f, 0.5f rnrn ;rn rn //创建顶点缓冲区rn if( FAILED( g_pd3dDevice->CreateVertexBuffer( 4*sizeof(CUSTOMVERTEX),rn 0, D3DFVF_CUSTOMVERTEX,rn D3DPOOL_MANAGED, &g_pVB,NULL ) ) )rn rn return E_FAIL;rn rnrn //填充顶点缓冲区rn VOID* pVertices;rn if( FAILED( g_pVB->Lock( 0, sizeof(g_Vertices), (void**)&pVertices, 0 ) ) )rn return E_FAIL;rn memcpy( pVertices, g_Vertices, sizeof(g_Vertices) );rn g_pVB->Unlock();rnrnrn g_pd3dDevice->CreateIndexBuffer(rn 5 * sizeof(WORD), // 3 indices per trianglern D3DUSAGE_WRITEONLY,rn D3DFMT_INDEX16,rn D3DPOOL_MANAGED,rn &g_pIB,rn NULL);rnrn DWORD* indices;rn g_pIB->Lock(0,0,(void**)&indices,D3DLOCK_DISCARD);rnrn indices[0] = 0;rn indices[1] = 1;rn indices[2] = 2;rn //indices[3] = 3;rnrn g_pIB->Unlock();rnrn return S_OK;rnrnrn//其他代码跳过,上渲染的代码。rnVOID Render()rnrnrn //清空后台缓冲区rn g_pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(45, 50, 170), 1.0f, 0 );rn rn //开始在后台缓冲区绘制图形rn if( SUCCEEDED( g_pd3dDevice->BeginScene() ) )rn rn g_pd3dDevice->SetTexture( 0, g_pTexture ); //设置纹理rn g_pd3dDevice->SetStreamSource( 0, g_pVB, 0, sizeof(CUSTOMVERTEX) );rn g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );rn g_pd3dDevice->SetIndices(g_pIB);rnrnrn //D3DPT_TRIANGLELISTrn //D3DPT_TRIANGLEFANrn g_pd3dDevice->DrawIndexedPrimitive(rn D3DPT_TRIANGLELIST ,rn 0,rn 0,rn 3,rn 0,rn 1);rn //g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST , 0, 1);rnrn //结束在后台缓冲区绘制图形rn g_pd3dDevice->EndScene();rn rnrn //将在后台缓冲区绘制的图形提交到前台缓冲区显示rn g_pd3dDevice->Present( NULL, NULL, NULL, NULL );rnrnrn如果我把DrawIndexedPrimitive注释掉,用DrawPrimitive来执行就可以渲染出三角形。rnrn我用的三角形渲染方式是 D3DPT_TRIANGLELIST rnrn谁知道为什么没有画出来啊?rn
用OpenCV画个简单的圆,结果画不出来
rn用OpenCV画个简单的圆,结果画不出来,只能显示原图像,没有圆。问题在哪里?请高手帮忙看看rn[code=c]#include "stdafx.h"rn#include "cv.h"rn#include "highgui.h"rnrnIplImage *image02 =0,*image03 = 0,*image04 = 0;rnrnint _tmain(int argc, _TCHAR* argv[])rnrn const char *filename ="d://Image001.bmp";rn if ((image03 = cvLoadImage(filename,0))==0)//读入图像为灰度图像rn rn return -1;rn rn rn cvNamedWindow("Source",1);rn cvShowImage("Source",image03);rn CvPoint centerpoint;rn centerpoint.x =100;rn centerpoint.y =200; rn cvCircle(image03,centerpoint,30,CV_RGB(255,255,255),3,8,1); //画圆,结果显示不出来rn cvWaitKey(0);rn cvReleaseImage(&image03);rn cvDestroyWindow("Source");rn return 0;rn rn[/code]
VS 环境创造不出来
求大神 解决  项目“hello”无法加载,因为它缺少安装组件。若要解决此问题,请使用以下选择启动 Visual Studio 安装程序:Microsoft.VisualStudio.Component.VC.Tools.x86.x64                这是那个组件...
相关热词 c#入门推荐书 c# 解码海康数据流 c# xml的遍历循环 c# 取 查看源码没有的 c#解决高并发 委托 c#日期转化为字符串 c# 显示问号 c# 字典对象池 c#5.0 安装程序 c# 分页算法