我想显示图像,但不知道该怎么做.我是否必须安装一些库文件或者只是它可以完成我不知道.实际上我想做图像处理,但首先我必须采取图像输入和显示图像然后我可以得到图像处理的效果作为输出,并决定它(算法)是否正确.我只安装了日食.我也在谷歌搜索,但无论他们建议什么都不好.要么我必须安装或不安装.我试过以下代码:
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JComponent;
import javax.swing.JFrame;
public class ImageTest {
public static void main(String[] args){
EventQueue.invokeLater(new Runnable()
{
public void run(){
ImageFrame frame = new ImageFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
);
}
}
class ImageFrame extends JFrame{
public ImageFrame(){
setTitle("ImageTest");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
ImageComponent component = new ImageComponent();
add(component);
}
public static final int DEFAULT_WIDTH = 300;
public static final int DEFAULT_HEIGHT = 200;
}
class ImageComponent extends JComponent{
/** …
Run Code Online (Sandbox Code Playgroud) 我是Django的新手.我在我的项目中创建了一个名为templates的文件夹,并在其中创建了"base.html",它工作正常.但是当我在模板欢迎中创建新文件夹然后"home.html"并且我在views.py文件中写了一些代码行
from django.shortcuts import render_to_response
def hello(request):
return render_to_response('welcome/home.html')
Run Code Online (Sandbox Code Playgroud)
和settings.py包括
# Django settings for Telecom project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
import os
#BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_DIR = os.path.dirname(__file__)
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'mysql', # Or path to database file if using sqlite3.
'USER': 'root', # Not used with sqlite3.
'PASSWORD': '', # Not used with …
Run Code Online (Sandbox Code Playgroud) 我想用datepicker实现一个django表单.我制作了forms.py
from django import forms
class DateRangeForm(forms.Form):
start_date = forms.DateField(widget=forms.TextInput(attrs=
{
'class':'datepicker'
}))
end_date = forms.DateField(widget=forms.TextInput(attrs=
{
'class':'datepicker'
}))
Run Code Online (Sandbox Code Playgroud)
和 views.py
if request.method == "POST":
f = DateRangeForm(request.POST)
if f.is_valid():
c = f.save(commit = False)
c.end_date = timezone.now()
c.save()
else:
f = DateRangeForm()
args = {}
args.update(csrf(request))
args['form'] = f
return render(request, 'trial_balance.html', {
'form': f
})
Run Code Online (Sandbox Code Playgroud)
balance.html
<div>
<form action="" method="POST"> {% csrf_token %}
Start Date:{{ form.start_date }} End Date:{{ form.end_date }}<br/>
<input type = "submit" name = …
Run Code Online (Sandbox Code Playgroud) 我已经安装了webpack
npm install -g webpack
和
npm install webpack
Run Code Online (Sandbox Code Playgroud)
我还安装了webpack-dev-server
npm install -g webpack-dev-server
Run Code Online (Sandbox Code Playgroud)
完成安装后,我运行了命令webpack但是,它显示以下错误
webpack:找不到命令
我没有得到什么是错误.
我们知道直方图和条形图是两回事.我有很多不同的方法来绘制高级图表中的条形图,但我没有得到任何关于高图中直方图的示例.是否可以使用highcharts绘制直方图,如果是,怎么样?
我是Django的新手.我使用pydev eclipse作为IDE.首先,我创建了一个项目,然后在该项目上欢迎应用程序.我在项目中创建了一个名为Templates的文件夹,并创建一个文件"home.html",home.html包含
<div>
This is my first site
</div>
Run Code Online (Sandbox Code Playgroud)
我将settings.py文件修改为
TEMPLATE_DIRS = ("Templates")
INSTALLED_APPS = (
..........#all default items
'welcome', #the added one
)
Run Code Online (Sandbox Code Playgroud)
views.py包括
from django.shortcuts import render_to_response
def home(request):
return render_to_response('home.html')
Run Code Online (Sandbox Code Playgroud)
urls.py包含
from django.conf.urls import patterns, include, url
from welcome.views import home
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'MajorProject.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^home/$', home),
)
Run Code Online (Sandbox Code Playgroud)
然后我将它作为django项目运行并打开我的浏览器并在localhost:8000/home上看到它显示错误
TemplateDoesNotExist at /home/
home.html
Request Method: GET
Request URL: http://localhost:8000/home/
Django Version: 1.6 …
Run Code Online (Sandbox Code Playgroud) 我只是django的初学者.我在Windows 8中使用pydev eclipse.首先我编写一个"Hello World"程序并在浏览器中显示该字符串,但是当我更改代码时,输出中的更改不会出现.无论我改变什么,输出都没有变化.但是,当我关闭eclipse并关闭计算机并重新启动时,我会更改程序并运行它.代码输出已更改.但现在进一步改变我的程序我再次需要重新启动我的电脑.怎么了 ?
我在windows中安装了3.3.0 python安装程序.然后我想安装MySQLdb.我在安装文件中搜索python 3.3.0,我得到了"MySQL-python-1.2.4b4.win32-py2.7"并安装了它.但它显示'需要python版本2.7,这在您的注册表中找不到'.我也在stackoverflow中得到了关于这个问题的解决方案,但我的问题没有解决.我试过的内容解释如下:
1. First I have exported python from registry HKEY_LOCAL_MACHINE-> Software.
2. I have saved the file in desktop.
3. I open it with notepad++.
4. Then I replaced all the LOCAL_MACHINE with CURRENT_USER and save it.
5. Finally I executed the saved file in desktop.
Run Code Online (Sandbox Code Playgroud)
但没有任何事情发生,我的问题没有解决,就像以前一样.它有什么解决方案吗?
我已wxpython
成功安装,我验证了
import wx
Run Code Online (Sandbox Code Playgroud)
但是当我编写代码时
import wx
class gui(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self, parent,id,'Visualisation for Telecom Customer Data', size = (300,200))
if __name__ =='__main__':
app = wx.PySimpleApp()
frame = gui(parent = None, id = -1)
frame.show()
app.MainLoop()
Run Code Online (Sandbox Code Playgroud)
它显示错误
Traceback (most recent call last):
File "D:\Bishnu\BE\4th year\7th semester\Major Project I\Workspace\Wxpython\default\GUI.py", line 13, in <module>
frame.show()
AttributeError: 'gui' object has no attribute 'show'
Run Code Online (Sandbox Code Playgroud)
可能是什么解决方案?
<a href = "{% url 'ngraph' %}">Customer Count</a>
Run Code Online (Sandbox Code Playgroud)
当我点击客户计数它只工作一次并使其工作我必须再次运行程序,这里有什么问题?我注意到的是,一旦链接localhost:8000/graph是(客户计数)点击,工作但忙于localhost:8000并且不起作用.怎么解决?
def graph(request):
age = ['below 20', '20-22','22-24','24-26','26-28','28-30','30-40','above 40']
avg_call_group = [0, 0, 0, 0, 0, 0, 0, 0]
cursor = connection.cursor()
cursor.execute("select p.age_group,sum(c.avg_duration) as age_avg_dur from demo p,(select card_no as card_n, avg(duration) as avg_duration from call_details where service_key = 1 and card_no =calling_no group by card_no) as c where p.card_no = c.card_n group by p.age_group ")
numrows = int(cursor.rowcount)
for x in range(numrows):
row = cursor.fetchone()
avg_call_group[x] = row[1]
cursor.close() …
Run Code Online (Sandbox Code Playgroud) django ×5
python ×3
datepicker ×1
highcharts ×1
html ×1
java ×1
jquery ×1
mysql-python ×1
npm ×1
npm-install ×1
python-2.7 ×1
webpack ×1
wxpython ×1