nesticot commited on
Commit
b4e00b7
·
verified ·
1 Parent(s): 941c813

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +113 -24
app.py CHANGED
@@ -402,7 +402,8 @@ app_ui = ui.page_fluid(
402
  }
403
  """)
404
  ),
405
- ui.tags.button(
 
406
  "Download as PNG",
407
  {"onclick": """
408
  html2canvas(document.getElementById('capture-div'), {
@@ -419,7 +420,7 @@ app_ui = ui.page_fluid(
419
  });
420
  """},
421
  {"style": "margin: 10px 0;"}
422
- ),
423
  ui.div(
424
  {"id": "capture-div"},
425
  ui.tags.h3(""),
@@ -444,31 +445,119 @@ app_ui = ui.page_fluid(
444
  ,
445
 
446
  ui.nav("Scorers Streamers",
447
- ui.tags.h3(""),
448
- ui.div({"style": "font-size:2.7em;"},ui.output_text("txt_title_streamers")),
449
- ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
450
- ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_f")),
451
- ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_f")),
452
- ui.output_table("scorer_streamers_f"),
453
- ui.tags.h3(""),
454
- ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_d")),
455
- ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_d")),
456
- ui.output_table("scorer_streamers_d"),
457
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
458
  ),
459
 
460
  ui.nav("Bangers Streamers",
461
- ui.tags.h3(""),
462
- ui.div({"style": "font-size:2.7em;"},ui.output_text("txt_title_streamers_bang")),
463
- ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
464
- ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_f_bang")),
465
- ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_f_bang")),
466
- ui.output_table("banger_streamers_f"),
467
- ui.tags.h3(""),
468
- ui.div({"style": "font-size:2em;"},ui.output_text("txt_title_streamers_roster_d_bang")),
469
- ui.div({"style": "font-size:1em;"},ui.output_text("txt_title_streamers_dates_d_bang")),
470
- ui.output_table("banger_streamers_d"),
471
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
  )
473
 
474
 
 
402
  }
403
  """)
404
  ),
405
+
406
+ ui.row(ui.tags.button(
407
  "Download as PNG",
408
  {"onclick": """
409
  html2canvas(document.getElementById('capture-div'), {
 
420
  });
421
  """},
422
  {"style": "margin: 10px 0;"}
423
+ )),
424
  ui.div(
425
  {"id": "capture-div"},
426
  ui.tags.h3(""),
 
445
  ,
446
 
447
  ui.nav("Scorers Streamers",
448
+ ui.div(
449
+ ui.tags.head(
450
+ ui.tags.script({"src": "https://html2canvas.hertzen.com/dist/html2canvas.min.js"}),
451
+ ui.tags.style("""
452
+ #capture-div {
453
+ display: inline-block;
454
+ background-color: white;
455
+ padding: 20px;
456
+ width: fit-content;
457
+ height: fit-content;
458
+ }
459
+ .table-container {
460
+ width: auto;
461
+ height: auto;
462
+ }
463
+ """)
464
+ ),
465
+ ui.row(ui.tags.button(
466
+ "Download as PNG",
467
+ {"onclick": """
468
+ html2canvas(document.getElementById('capture-div'), {
469
+ scale: 2,
470
+ useCORS: true,
471
+ backgroundColor: '#ffffff',
472
+ windowWidth: document.getElementById('capture-div').scrollWidth,
473
+ windowHeight: document.getElementById('capture-div').scrollHeight
474
+ }).then(function(canvas) {
475
+ var link = document.createElement('a');
476
+ link.download = 'nhl-streamers.png';
477
+ link.href = canvas.toDataURL('image/png');
478
+ link.click();
479
+ });
480
+ """},
481
+ {"style": "margin: 10px 0;"}
482
+ )),
483
+ ui.div(
484
+ {"id": "capture-div"},
485
+ ui.tags.h3(""),
486
+ ui.div({"style": "font-size:2.7em;"}, ui.output_text("txt_title_streamers")),
487
+ ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
488
+ ui.div({"style": "font-size:2em;"}, ui.output_text("txt_title_streamers_roster_f")),
489
+ ui.div({"style": "font-size:1em;"}, ui.output_text("txt_title_streamers_dates_f")),
490
+ ui.div(
491
+ {"class": "table-container"},
492
+ ui.output_table("scorer_streamers_f")
493
+ ),
494
+ ui.tags.h3(""),
495
+ ui.div({"style": "font-size:2em;"}, ui.output_text("txt_title_streamers_roster_d")),
496
+ ui.div({"style": "font-size:1em;"}, ui.output_text("txt_title_streamers_dates_d")),
497
+ ui.div(
498
+ {"class": "table-container"},
499
+ ui.output_table("scorer_streamers_d")
500
+ )
501
+ )
502
+ )
503
  ),
504
 
505
  ui.nav("Bangers Streamers",
506
+ ui.div(
507
+ ui.tags.head(
508
+ ui.tags.script({"src": "https://html2canvas.hertzen.com/dist/html2canvas.min.js"}),
509
+ ui.tags.style("""
510
+ #capture-div {
511
+ display: inline-block;
512
+ background-color: white;
513
+ padding: 20px;
514
+ width: fit-content;
515
+ height: fit-content;
516
+ }
517
+ .table-container {
518
+ width: auto;
519
+ height: auto;
520
+ }
521
+ """)
522
+ ),
523
+ ui.row(ui.tags.button(
524
+ "Download as PNG",
525
+ {"onclick": """
526
+ html2canvas(document.getElementById('capture-div'), {
527
+ scale: 2,
528
+ useCORS: true,
529
+ backgroundColor: '#ffffff',
530
+ windowWidth: document.getElementById('capture-div').scrollWidth,
531
+ windowHeight: document.getElementById('capture-div').scrollHeight
532
+ }).then(function(canvas) {
533
+ var link = document.createElement('a');
534
+ link.download = 'nhl-banger-streamers.png';
535
+ link.href = canvas.toDataURL('image/png');
536
+ link.click();
537
+ });
538
+ """},
539
+ {"style": "margin: 10px 0;"}
540
+ )),
541
+ ui.div(
542
+ {"id": "capture-div"},
543
+ ui.tags.h3(""),
544
+ ui.div({"style": "font-size:2.7em;"}, ui.output_text("txt_title_streamers_bang")),
545
+ ui.tags.h5("Created By: @TJStats, Data: NHL, Natural Stat Trick, Yahoo Fantasy"),
546
+ ui.div({"style": "font-size:2em;"}, ui.output_text("txt_title_streamers_roster_f_bang")),
547
+ ui.div({"style": "font-size:1em;"}, ui.output_text("txt_title_streamers_dates_f_bang")),
548
+ ui.div(
549
+ {"class": "table-container"},
550
+ ui.output_table("banger_streamers_f")
551
+ ),
552
+ ui.tags.h3(""),
553
+ ui.div({"style": "font-size:2em;"}, ui.output_text("txt_title_streamers_roster_d_bang")),
554
+ ui.div({"style": "font-size:1em;"}, ui.output_text("txt_title_streamers_dates_d_bang")),
555
+ ui.div(
556
+ {"class": "table-container"},
557
+ ui.output_table("banger_streamers_d")
558
+ )
559
+ )
560
+ )
561
  )
562
 
563