我最近被迫使用python3.5进行项目,这很好,因为它可以从import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class FrameCanvas extends Application{
public static void main(String[] args){
launch(args);
}
@Override
public void start(Stage primaryStage)throws Exception{
////////////////////Basic FX stuff
Canvas theCanvas = new Canvas(900,900);
StackPane theLayout = new StackPane();
theLayout.getChildren().add(theCanvas);
Scene theScene = new Scene(theLayout,900,900);
primaryStage.setScene(theScene);
primaryStage.show();
///////////////////////
/////Drawing an X
///////////////////////
GraphicsContext gc = theCanvas.getGraphicsContext2D();
Thread.sleep(1000);
gc.strokeLine(0,0,200,200);
Thread.sleep(1000);
gc.strokeLine(200,0,0,200);
/////////////////////////////
}
}
顺利安装。唯一的问题是我现在不知道如何安装iPython。
我继续apt-repository ppa:fkrull/deadsnakes
,这似乎很顺利,但现在sudo python3.5 -m pip install ipython
和python3.5
python3.5 ipython
都没有显示任何可用的迹象。