2022年9月28日水曜日

p5js textarea scrollbar ではまったので残しておく

20220928

p5jsでtextareaをつかいたかったのと

スクロールバーのスクロール具合を知りたかったので調べたら

2日ほど潰れてくやしいので記録しておく

scrollTopの前にeltをつければ良いみたい

正道かどうかは不明


ブラウザのデバッグモードの要素のイベントリスナーの

blurのwindowのhandlerの[[scopes]]のスクリプトのmyTxtareaの

eltでその他のメンバーが見られるので必要がアレば探そう


p5js ウェブエディターで以下のコードで検証



let myTextArea;
let btnname=['A','B'];
let butn=[];

function aset(){
  myTextArea.elt.rows=5;
  myTextArea.elt.scrollTop=50;
}

function bset(){
  myTextArea.elt.rows=10;
  myTextArea.elt.scrollTop=100;  
}


function setup() {
  createCanvas(400, 550);
  // init textarea
  myTextArea = createElement('textarea');
  myTextArea.attribute("rows","10");
  myTextArea.attribute("cols","50");
  myTextArea.value('0\n1\n2\n3\n4\n5\n6\n7\n0\n1\n2\n3\n4\n5\n6\n7');
  myTextArea.position(20,20);
  
  //init buttons
  for(let i=0;i<btnname.length;i++){
    butn[i] = createButton(btnname[i]);
    butn[i].position(20+i*50, 230);
  }
  butn[0].mousePressed(aset);
  butn[1].mousePressed(bset);
}

function draw() {
  background(220);  
  text(" scrollTop "+myTextArea.elt.scrollTop ,20,280); 
  text(myTextArea.value(),20,310); 
}

raspiでseleniumの自動化用のファイル作り直し

2024/2/17に不注意でraspiのsdカードを壊し jupyterファイルのバックアップを取らずにos再インストールを試みるという 愚行を重ねたためまたjupyterで作業ファイルを作ることになったので念の為 残しておく 途中なので要らない行も有るかも これだけ再現できれば...