Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  output-widget.ipynb   Sprache: unbekannt

 
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example of text output in francy\n",
    "\n",
    "This example creates a Graph with one node. Clicking on the node will trigger the function that will print the input from the user in a new OuputWidget below Francy Graph."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "true"
      ]
     },
     "execution_count": 1,
     "metadata": {
      "text/plain": ""
     },
     "output_type": "execute_result"
    },
    {
     "data": {
      "application/vnd.francy+json": "{\"canvas\" : {\"graph\" : {\"collapsed\" : true,\"id\" : \"F9C9D4FA0607A4A78AC21DE8BBD697CC7\",\"links\" : {},\"nodes\" : {\"F6C78AAF6F91848E45432FDFD90DDE4F8\" : {\"callbacks\" : {\"F8F419FE8CFAC4BB2E4B26A36CFD237A4\" : {\"confirm\" : \"This is a confirmation message...\",\"func\" : \"HelloWorld\",\"id\" : \"F8F419FE8CFAC4BB2E4B26A36CFD237A4\",\"knownArgs\" : [],\"requiredArgs\" : {\"F1DE6EE59E29D4239443125A0840082FE\" : {\"id\" : \"F1DE6EE59E29D4239443125A0840082FE\",\"title\" : \"Selected Nodes\",\"type\" : \"select\",\"value\" : \"\"},\"FB06212CEB92941256CD0C925F3CC61FD\" : {\"id\" : \"FB06212CEB92941256CD0C925F3CC61FD\",\"title\" : \"Your Name?\",\"type\" : \"text\",\"value\" : \"\"}},\"trigger\" : \"click\"}},\"color\" : \"#2E8B57\",\"id\" : \"F6C78AAF6F91848E45432FDFD90DDE4F8\",\"layer\" : 0,\"menus\" : {\"F16F84EF01FBE4F14B485CA820A658A6B\" : {\"callback\" : {\"confirm\" : \"This is a confirmation message...\",\"func\" : \"HelloWorld\",\"id\" : \"F8F419FE8CFAC4BB2E4B26A36CFD237A4\",\"knownArgs\" : [],\"requiredArgs\" : {\"F1DE6EE59E29D4239443125A0840082FE\" : {\"id\" : \"F1DE6EE59E29D4239443125A0840082FE\",\"title\" : \"Selected Nodes\",\"type\" : \"select\",\"value\" : \"\"},\"FB06212CEB92941256CD0C925F3CC61FD\" : {\"id\" : \"FB06212CEB92941256CD0C925F3CC61FD\",\"title\" : \"Your Name?\",\"type\" : \"text\",\"value\" : \"\"}},\"trigger\" : \"click\"},\"id\" : \"F16F84EF01FBE4F14B485CA820A658A6B\",\"menus\" : {},\"title\" : \"Hello Menu Action\"}},\"messages\" : {},\"parent\" : \"\",\"size\" : 10,\"title\" : \"\",\"type\" : \"circle\",\"x\" : 0,\"y\" : 0}},\"simulation\" : true,\"type\" : \"undirected\"},\"height\" : 450,\"id\" : \"F9244B56CDAA14A0AEC2AE32D768B6BB9\",\"menus\" : {\"F16F84EF01FBE4F14B485CA820A658A6B\" : {\"callback\" : {\"confirm\" : \"This is a confirmation message...\",\"func\" : \"HelloWorld\",\"id\" : \"F8F419FE8CFAC4BB2E4B26A36CFD237A4\",\"knownArgs\" : [],\"requiredArgs\" : {\"F1DE6EE59E29D4239443125A0840082FE\" : {\"id\" : \"F1DE6EE59E29D4239443125A0840082FE\",\"title\" : \"Selected Nodes\",\"type\" : \"select\",\"value\" : \"\"},\"FB06212CEB92941256CD0C925F3CC61FD\" : {\"id\" : \"FB06212CEB92941256CD0C925F3CC61FD\",\"title\" : \"Your Name?\",\"type\" : \"text\",\"value\" : \"\"}},\"trigger\" : \"click\"},\"id\" : \"F16F84EF01FBE4F14B485CA820A658A6B\",\"menus\" : {},\"title\" : \"Hello Menu Action\"},\"FFF362CF34FE34521EC835B679ACE7338\" : {\"callback\" : {},\"id\" : \"FFF362CF34FE34521EC835B679ACE7338\",\"menus\" : {\"F16F84EF01FBE4F14B485CA820A658A6B\" : {\"callback\" : {\"confirm\" : \"This is a confirmation message...\",\"func\" : \"HelloWorld\",\"id\" : \"F8F419FE8CFAC4BB2E4B26A36CFD237A4\",\"knownArgs\" : [],\"requiredArgs\" : {\"F1DE6EE59E29D4239443125A0840082FE\" : {\"id\" : \"F1DE6EE59E29D4239443125A0840082FE\",\"title\" : \"Selected Nodes\",\"type\" : \"select\",\"value\" : \"\"},\"FB06212CEB92941256CD0C925F3CC61FD\" : {\"id\" : \"FB06212CEB92941256CD0C925F3CC61FD\",\"title\" : \"Your Name?\",\"type\" : \"text\",\"value\" : \"\"}},\"trigger\" : \"click\"},\"id\" : \"F16F84EF01FBE4F14B485CA820A658A6B\",\"menus\" : {},\"title\" : \"Hello Menu Action\"}},\"title\" : \"Example Menu Holder\"}},\"messages\" : {},\"texTypesetting\" : true,\"title\" : \"Callbacks in action\",\"width\" : 800,\"zoomToFit\" : true},\"mime\" : \"application\\/vnd.francy+json\",\"version\" : \"1.2.4\"}"
     },
     "execution_count": 23,
     "metadata": {
      "application/vnd.francy+json": {}
     },
     "output_type": "execute_result"
    }
   ],
   "source": [
    "LoadPackage(\"francy\");\n",
    "\n",
    "canvas2 := Canvas(\"Callbacks in action\");;\n",
    "SetHeight(canvas2, 450);;\n",
    "\n",
    "graph := Graph(GraphType.UNDIRECTED);; # will go throughout graphs later\n",
    "shape := Shape(ShapeType.CIRCLE);; # will go throughout shapes later\n",
    "SetColor(shape, \"#2E8B57\");;\n",
    "Add(graph, shape);;\n",
    "Add(canvas2, graph);;\n",
    "\n",
    "HelloWorld := function(name, node)\n",
    "    return Concatenation(\"Hello, \", name, \" you have selected the node with ID \", String(node));\n",
    "end;;\n",
    "\n",
    "callback1 := Callback(HelloWorld);;\n",
    "SetConfirmMessage(callback1, \"This is a confirmation message...\");;\n",
    "arg1 := RequiredArg(ArgType.STRING, \"Your Name?\");;\n",
    "arg2 := RequiredArg(ArgType.SELECT, \"Selected Nodes\");;\n",
    "Add(callback1, arg1);;\n",
    "Add(callback1, arg2);;\n",
    "\n",
    "Add(shape, callback1);;\n",
    "\n",
    "menu := Menu(\"Example Menu Holder\");;\n",
    "menu1 := Menu( \"Hello Menu Action\", callback1 );;\n",
    "Add(menu, menu1);;\n",
    "\n",
    "Add(canvas2, menu);;\n",
    "Add(canvas2, menu1);;\n",
    "Add(shape, menu1);;\n",
    "\n",
    "Draw(canvas2);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "GAP 4",
   "language": "gap",
   "name": "gap-4"
  },
  "language_info": {
   "codemirror_mode": "gap",
   "file_extension": ".g",
   "mimetype": "text/x-gap",
   "name": "GAP 4",
   "nbconvert_exporter": "",
   "pygments_lexer": "gap",
   "version": "4.13dev"
  },
  "widgets": {
   "application/vnd.jupyter.widget-state+json": {
    "state": {},
    "version_major": 2,
    "version_minor": 0
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

[ Dauer der Verarbeitung: 0.2 Sekunden  (vorverarbeitet)  ]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge